Pertemuan 2


Form kali ini membahas tentang lost focus,yaitu ketika kita mengisi text box,maka text box lain akan terisi secara otomatis.
kodenya adalah

ublic Class Form1

    Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMulai.Click
        
        txt3.Text = txt1.Text * txt2.Text
        txt4.Text = txt4.Text = txt3.Text * 10%
        txt5.Text = txt3.Text - txt4.Text  
  End Sub
Private Sub txt5_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt5.LostFocus
        txt5.Text = txt3.Text - txt4.Text
    End Sub

    Private Sub txt5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt5.TextChanged

    End Sub

    Private Sub txt2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt2.LostFocus

    End Sub

    Private Sub txt2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt2.TextChanged
        txt3.Text = txt1.Text * txt2.Text
    End Sub

    Private Sub txt4_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt4.LostFocus

    End Sub

    Private Sub txt4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt4.TextChanged
        txt5.Text = txt3.Text - txt4.Text
    End Sub

    Private Sub txt3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt3.LostFocus

    End Sub

    Private Sub txt3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt3.TextChanged
        txt4.Text = txt3.Text * 0.1
    End Sub
End Class

0 komentar:

Posting Komentar