Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
Dim sex(3) As String
sex(0) = "นาย"
sex(1) = "นางสาว"
sex(2) = "นาง"
Dim i As Integer
For i = 0 To 2
ComboBox1.Items.Add(sex(i))
Next
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
ComboBox1.SelectedIndex = 1
RadioButton1.Text = "โสด"
RadioButton2.Text = "สมรส"
RadioButton3.Text = "หย่าร้าง"
RadioButton1.Checked = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t As Byte
Dim g As Integer
t = Val(TextBox3.Text) + Val(TextBox4.Text)
Label6.Text = Val(TextBox3.Text) + Val(TextBox4.Text)
Select Case t
Case Is <= 49
g = "F"
Case Is <= 59
g = "D"
Case Is <= 69
g = "C"
Case Is <= 79
g = "B"
Case Is <= 100
g = "A"
End Select
Label6.Text = g
If RadioButton1.Checked = True Then
Label6.Text = RadioButton1.Text
End If
If RadioButton2.Checked = True Then
Label6.Text = RadioButton1.Text
End If
If RadioButton3.Checked = True Then
Label6.Text = RadioButton1.Text
End If
End Sub
End Class
Top |