Controls in Visual Basic
In visual basic there are different controls which are used for designing forms or windows or GRAPHICAL USER INTERFACE (G U I ). Microsoft visual basic provides several standard interface controls that can be used to create user interface
Types of Control
1 Standard control
2 Activx control
Standard Control
Label
label control is used for display no-editable information.Mainly this control is used for providing information to user .Frame
Frame control is used for grouping of the other control on the form .It Serves as a container forother controls. Provides a
method for grouping
controls. (To group controls
in a frame, select the frame
with a single-click first,
then draw a control in it.)
Check-Box
Displays or enables input ofa two-part choice, such as
Yes/No or True/False.
Private Sub Check1_Click()
If Check1.Value = 1 Then
Check1.Caption = "Checked"
Else
Check1.Caption = "Unchecked"
End If
End Sub
ListBox
It displays a list of itemsfrom which the user can
select one or more entries.
Properties of ListBox
1)Additem():- this method used to add item in the listbox.
2)Removeitem():-this method is used for removing item from list.
HscrollBar (HorizontalScroll bar)
IT Produces a numerical valuebased on the scroll bar's
horizontal position.
Timer
IT Provides a means for anaction to be taken after
passage of a certain amount
of time.
example:-developing simple clock
''source code
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
//end
Tips:-
1:-Drag one label on the form ,change its backstyle property to the transparent (0).
2:-Change backstyle property to the none(0) so close button will disapear .
3:-set timer interval to 200 millisecond .
4:-select layout out of aplication on window .
5:-make its .exe and add to startup menu it will start as you log-on to your computer.
scroll box.
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
//end
Tips:-
1:-Drag one label on the form ,change its backstyle property to the transparent (0).
2:-Change backstyle property to the none(0) so close button will disapear .
3:-set timer interval to 200 millisecond .
4:-select layout out of aplication on window .
5:-make its .exe and add to startup menu it will start as you log-on to your computer.
scroll box.
Dir Listbox
shape
Displays geometric shapes on the form.like circle,oval , rectangle etc
Image
Displays a graphic image Similar in appearance to the picture control but withdifferent functionality.
TextBox
Displays text that the usecan edit.
Enables the user to initiate a program action. Can
nclude an icon, caption,and ToolTips.