Thursday, December 15, 2011

Got Focus

1. A program that will illustrate the GotFocus event with four text box and a label. As you move the focus from one text box to another, the label will tell you which of them has the focus.



2. The CODE:


Public Class frm3

Private Sub GotFocus_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

Private Sub MultipleEvents(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter, TextBox2.Enter, TextBox3.Enter, TextBox4.Enter

ShowInfo.Text = "Text " & Microsoft.VisualBasic.Right(ActiveControl.Name, 1) & " is in Focus"
End Sub

Private Sub Label1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.Leave
End Sub

Private Sub backtoindex_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

Me.Close()
End Sub

End Class

3. Save & Run your program.

No comments:

Post a Comment