stu nicholls dot com | menu - Professional dropdown #3

click here


LinkLabel

This is a control which gives the hyperlink functionality, formatting and tracking.
In the following application the LinkLabel control is given a functionality to hyperlink a website (shown in Fig. 32 and 33)


Fig39


Fig40


Public Class Form1
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
System.Diagnostics.Process.Start("www.mgmudupi.ac.in")
End Sub
End Class

In the following application the LinkLabel control is given a functionality to hyperlink to create a new form (shown in Fig. 41 and 42). Fig41


Fig42


Public Class AnotherForm
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Dim newform As New Form()
newform.Show()
End Sub
End Class

ProgressBar

This displays a bar that fills to indicate to the user the progress of operation.
Timer, Label, Button and Progress bar controls are added in the following application (shown in Fig. 43) which demonstrates the usage of Progress Bar control. For every second (as timer interval is specified as 1000) the Progress Bar control’s value is increased by 5 and when its value reaches 100 then message of completion of work is displayed (shown in Fg. 44 and 45).

Fig43


Fig44


Fig45


Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
ProgressBar1.Value = 0
Button1.Enabled = False
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value = ProgressBar1.Value + 5
If ProgressBar1.Value >= 100 Then
Timer1.Enabled = False
Button1.Enabled = True
End If
Label1.Text = "Completed Work" + Str(ProgressBar1.Value) + "%"
If Label1.Text = "Completed Work 100%" Then
MessageBox.Show(" Work Completed!!")
End If
End Sub
End Class

Panel:

This is used to group different controls on the form. The panel works like a Group box but it cannot be given a caption.
The Application shown in Fig. 39 put together the radio buttons and check boxes in a panel. The code follows it.
Radio buttons for the options Male, Female in one panel
Check boxes for languages Kannada, Telugu and Marathi in other panel
Fig46


Public Class Form1
Dim person As String
Dim age As String
Dim lan1, lan2, lan3 As String
Dim sex As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
person = TextBox1.Text
age = TextBox2.Text
If RadioButton1.Checked = True Then
sex = RadioButton1.Text
End If

If RadioButton2.Checked = True Then
sex = RadioButton2.Text
End If
If CheckBox1.Checked = True Then
lan1 = CheckBox1.Text
End If
If CheckBox2.Checked = True Then
lan2 = CheckBox2.Text
End If
If CheckBox3.Checked = True Then
lan3 = CheckBox3.Text
End If
MsgBox("Name:" & person & Chr(13) & "age:" & age & Chr(13) & "Sex:" & sex & Chr(13) & "Language:" & lan1 & " , " & lan2 & " " & lan3 & Chr(13) & "state:" & ListBox1.SelectedItem, , " My Details")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
Group Box:

This is also used to group different controls on the form. The Group box works like a Panel but it can be given a caption.
The Application shown in Fig. 40 put together the radio buttons and check boxes in a Group Box and caption is given to it. The code follows it.
Radio buttons for the options Male, Female in one Group box and caption Sex is given to it. Check boxes for languages Kannada, Telugu and Marathi in other Group box and caption Languages given to it.

Fig47


>>Program

<< Previous   Next>>


comments powered by Disqus
click here
click here
Footer1