0% found this document useful (0 votes)
25 views

Public Class Form2

The document defines a form class with event handlers that clear text boxes when a button is clicked, close the form when another button is clicked, populate a text box based on a combo box selection, and populate a text box based on selecting a radio button.

Uploaded by

fredella Agatha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Public Class Form2

The document defines a form class with event handlers that clear text boxes when a button is clicked, close the form when another button is clicked, populate a text box based on a combo box selection, and populate a text box based on selecting a radio button.

Uploaded by

fredella Agatha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Me.TextBox1.Clear()
Me.TextBox2.Clear()
Me.TextBox3.Clear()
Me.TextBox4.Clear()
Me.TextBox1.Focus()
Me.ComboBox1.Text = " "

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Me.Close()
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.Text = "IPA" Then
Me.TextBox4.Text = "Ilmu Pengetahuan Alam"
ElseIf Me.ComboBox1.Text = "IPS" Then
Me.TextBox4.Text = "Ilmu Pengetahuan Sosial"
ElseIf Me.ComboBox1.Text = "Bahasa" Then
Me.TextBox4.Text = "Bahasa Indonesia"
ElseIf Me.ComboBox1.Text = "Agama" Then
Me.TextBox4.Text = "Keagamaan"
End If
End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If Me.RadioButton1.Text = "L" Then
Me.TextBox3.Text = "Laki-Laki"

End If
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If Me.RadioButton2.Text = "P" Then
Me.TextBox3.Text = "Perempuan"

End If
End Sub
End Class

You might also like