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.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% 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.
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"