Visual Basic
Dibawah ini adalah contoh code untuk menjalankan LostFocus dab GotFocus
Public Class frm_events_lostFocus_dan_gotfocus
Private Sub txtcoba1_GotFocus(sender As Object, e As EventArgs) Handles txtcoba1.GotFocus
txtcoba1.BackColor = Color.Yellow
End Sub
Private Sub txtcoba1_LostFocus(sender As Object, e As EventArgs) Handles txtcoba1.LostFocus
txtcoba1.BackColor = Color.White
End Sub
Private Sub txtcoba1_TextChanged(sender As Object, e As EventArgs) Handles txtcoba1.TextChanged
End Sub
Private Sub txtcoba2_GotFocus(sender As Object, e As EventArgs) Handles txtcoba2.GotFocus
txtcoba2.BackColor = Color.White
End Sub
Private Sub txtcoba2_LostFocus(sender As Object, e As EventArgs) Handles txtcoba2.LostFocus
txtcoba2.BackColor = Color.Blue
End Sub
Private Sub txtcoba2_TextChanged(sender As Object, e As EventArgs) Handles txtcoba2.TextChanged
End Sub
Private Sub txtnama_TextChanged(sender As Object, e As EventArgs) Handles txtnama.TextChanged
lblnama.Text = txtnama.Text
End Sub
End Class
Private Sub txtcoba1_GotFocus(sender As Object, e As EventArgs) Handles txtcoba1.GotFocus
txtcoba1.BackColor = Color.Yellow
End Sub
Private Sub txtcoba1_LostFocus(sender As Object, e As EventArgs) Handles txtcoba1.LostFocus
txtcoba1.BackColor = Color.White
End Sub
Private Sub txtcoba1_TextChanged(sender As Object, e As EventArgs) Handles txtcoba1.TextChanged
End Sub
Private Sub txtcoba2_GotFocus(sender As Object, e As EventArgs) Handles txtcoba2.GotFocus
txtcoba2.BackColor = Color.White
End Sub
Private Sub txtcoba2_LostFocus(sender As Object, e As EventArgs) Handles txtcoba2.LostFocus
txtcoba2.BackColor = Color.Blue
End Sub
Private Sub txtcoba2_TextChanged(sender As Object, e As EventArgs) Handles txtcoba2.TextChanged
End Sub
Private Sub txtnama_TextChanged(sender As Object, e As EventArgs) Handles txtnama.TextChanged
lblnama.Text = txtnama.Text
End Sub
End Class
0 komentar:
Posting Komentar