Option Button:
These provide the capability to make a mutually exclusive choice among a group of potential candidate choices. Hence, option buttons work as a group, only one of which can have a True (or selected) value.

Following program sets the size of the font as selected by the help of the option button. Typed text in the text box is shown with the selected font size. Fig. 4 gives the resultant screen when the application was executed

List Box: A list box displays a list of items from which the user can select one or more items. If the number of items exceeds the number that can be displayed, a scroll bar is automatically added.
Combo Box: The combo box is similar to the list box. The differences are a combo box includes a text box on top of a list box and only allows selection of one item. In some cases, the user can type in an alternate response. The following program has one list box, two combo boxes, one text box, one label and two buttons added to the form. The program generates the time table for the individual faculty. Fig. 5 shows the initial design. When you run the program initial values in List box and Combo box are loaded which is shown in Fig. 6. Then you enter and select appropriate values and press the OK button then your time table is generated which is shown in Fig. 7.



Timer: Raises an event at user defined intervals
The important property of the timer Control is Interval. If the Interval property is set to 4000, it means, the event will be triggered every 4 seconds after the timer has been enabled or started.
The Default event is Tick. The timer control is not visible in the run form.
The Following application generates Background Colors on the form.
Add a timer and set the following properties
Interval – 1000
Enabled – True
Public Class Form2
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
Me.BackColor = Color.FromArgb(255 * Rnd(), 255 * Rnd(),
255 * Rnd())
End Sub
End Class

PictureBox:

This displays an image.
In the following example PictureBox Control, Timer control and Button are added as shown Fig.2


The following code loads the picture box with different pictures from the destination after every two seconds as shown in Fig. 3.

Public Class Form1
Dim pics() As String = {"D:\Content-pp\VB.NET-08\vb.net_prgms\ ControlsExamples\Pics\DSCN4594.jpg",
"D:\Content-pp\VB.NET-08\vb.net_prgms\ ControlsExamples\Pics\DSCN4597.jpg",
"D:\Content-pp\VB.NET-08\vb.net_prgms\ ControlsExamples\Pics\DSCN4598.jpg"}
Dim i As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Image = Image.FromFile(pics(i))
i = i + 1
If i > 2 Then
i = 0
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start.Click
i = 0
Timer1.Interval = 2000 'in milliseconds between timer ticks
Timer1.Enabled = True
End Sub
End Class



Text,Label,Button<< Previous

Next >> Date Time Picker

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus




Footer1