Search This Blog

The Control Properties

Before writing an event procedure for the control to response to a user's input, you have to set certain properties for the control to determine its appearance and how it will work with the event procedure. You can set the properties of the controls in the properties window or at runtime.

Form Properties

In visual basic windows are known as forms ,when u run any form we get a result as window .Forms provide platform for getting control together . we can add controls to forms in the Integrated Development Environment (IDE).In forms we add menubar ,which can help us for declaring menu's in the project .



Properties of form ...

 

 

I am not going into the details on how to set the properties. However, I would like to stress a few important points about setting up the properties.

Caption

we should set the Caption Property of a control clearly ,so that a user knows what to do with that command like i am designing screen for my "Parking management System" so the caption must indicate the proer name to user .
The caption of any button should be very clear like for login screen there must be atleast two button like "CONFIRM" and "CANCEL" .


Name

Thia properties is more important to Developer as compare to user because all the procedure and events are written on that name and it also easier to debug or modify the programs later. However, it is not a must to do that as long as you label your objects clearly and use comments in the program whenever you feel necessary.


Enabled

This is very important property in visual basic , because it is important too check this property before code and run . in visual basic 6.0 most controls are default true state like timer is in default true state ,in vb .net it comes in false state , so it is important to check it .


Visible

Finally, we must also considering making the control visible or invisible at runtime, or when should it become visible or invisible.



common controls

The text box is the standard control for accepting input from the user as well as to display the output. It can handle string and numeric data but not images or pictures. String in a text box can be converted to a numeric data by using the function Val(text). The following example illustrates a simple program that processes the input from the user.


n this program, three text boxes are inserted into the form together with a few labels. The two text boxes are used to accept inputs from the user and one of the another text box will be used to display the sum of two numbers that are entered into the two text boxes. Besides, a command button is also programmed to calculate the sum of the two numbers using the plus(+) operator.


Private Sub Command1_Click()
Dim a, b, c
a = Val(Text1.Text) ' first text box ,and first number .
b = Val(Text2.Text) ' second text box ,and second number.
c = a + b 'addtion.
Text3.Text = c 'displaying result.

End Sub