Visual basic pdf tutorial for beginners




















It also consists of a toolbox which contains many useful controls that allows the I programmer to develop his or her Visual Basic programs. You can drag and move your toolbox around and dock it to the right, left, top or bottom of the IDE. Next, insert a button and change its text to OK. The design interface is shown in Figure 1.

You have also learned how to write your first program. To build a graphical user interface, first of all you need to customize the default form by changing its properties at design phase and at runtime, including its name, title, background color and so forth. After customizing the default form, you may proceed to add controls from the toolbox to the form and then customize their properties.

The name of the default form is Form1. The properties window displays all the properties related to Form1 and their corresponding attributes or values. You can change the name of the form, the title of the form using the text property, the background color, the foreground color, size and more. Clicking on the drop-down arrow will bring out a color palette or a list of color rectangles where you can select a color. Figure 2. The values of R, G and B ranges from 0 to , therefore, by varying the values of the RGB we can obtain different colors.

For example, an RGB value of , , yield the cyan color. The bytes represent the red, green and blue components of the color. One byte represents a number ranging from 00 to FF in hexadecimal notation , or 0 to in decimal notation.

However, when you type the Hex color code in the properties window of VS, it automatically converts the color to RGB color or the color name. In the runtime interface, notice that the title has been changed from Form1 to My First Visual Basic App, background color changed to LavenderBlush , the text OK color is Crimson and the window cannot be maximized.

Ivory MyBtn. Notice that is is now different from that shown in Figure 2. The runtime interface is as shown in Figure 2. Next, we shall continue to build the UI by adding some controls to the form. The controls are objects that consist of three elements, namely properties, methods, and events.

They can be added to the form from the Toolbox. Among the controls, the most common ones are the button, label, textbox, listbox, combobox, picture box, checkbox, radio button and more. These controls can be made visible or invisible at runtime. However, some controls will only run in the background and never be seen at runtime, one such control is the timer. The Toolbox is usually hidden when you start Visual Basic IDE, you need to click View on the menu bar and then select Toolbox to reveal the tool box, as shown in Figure 2.

You can also dock the toolbox by right-clicking on the tool box and choose dock from the pop-up menu. The docked Toolbox that appears side by side with the Solution Explorer, and as one of the tabbed windows together with the Form Design window and the code window, as shown in Figure 2. Further, you may also pin the tool box to the side bar or the bottom bar by clicking on the pin icon on the menu bar of the toolbox.

How and where you want to position your tool box is entirely up to you but we strongly suggest that you place the tool box alongside or at the bottom of the default form so that it is easy for you to add controls from the tool box into the form.

You should never cover the form with the toolbox because it will be difficult to add controls to the form. You can drag the control around the form and you can also resize it. Next Loop. Graphical Mouse Application. Mouse Move application in Visual Basic 6. Writing Code that Validates User Input. Creating ActiveX Controls.

Creating Active Document. Contents Getting started to the lesson. Then and Select InputBox function Visual Basic functions. But by using VBA, we can make our jobs easier as we can make macros that will do our repetitive tasks for us. What is a macro again? Macro is a set of instructions that are given to do a specified task. In this article, we will learn about the basics of VBA. It is the best VBA Tutorial for beginners.

In VBA, we create macros, and as defined above, macros are a set of instructions that are given to do a specific task. There are two ways to give these instructions for macros. One is through writing codes in VBA itself, while another is done by recording a macro.

In excel, we have a special feature in which we record our steps, and excel does the same steps for us over and over when giving excel command to run that code. But it has certain limitations to it, so we write codes in VB Editor where there is an ultimate number of opportunities to automate our tasks. Watch our Demo Courses and Videos. VBA is basically a programming language just like C and Java and everything else. Here we record a set of instructions by writing some block of codes, and when we run these blocks of codes, they do the specified tasks for us.

By default, VBA is not accessible in excel.



0コメント

  • 1000 / 1000