📄 form1.vb
字号:
Public Class Exam2
Dim index As Integer
Dim state() As String = {"Alaska", "Hawaii", "Kentucky", "Pennsylvania", "Texas"}
Dim capital() As String = {"Juneau", "Honolulu", "Frankfort", "Harrisburg", "Austin"}
Dim word As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Text = "Choose a state"
TextBox1.Text = ""
ComboBox2.Text = "Choose a capital"
TextBox2.Text = ""
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
index = ComboBox1.SelectedIndex
word = CStr(capital(index))
TextBox1.Text = word
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
index = ComboBox2.SelectedIndex
word = CStr(state(index))
TextBox2.Text = word
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -