我正在使用Visual Studio 2012
我想知道如何在不按任何按钮的情况下根据变量组合框值自动更改文本框值。
感谢
答案 0 :(得分:0)
把它放在主页面上
答案 1 :(得分:0)
处理其SelectedIndexChanged
事件
例如:
Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex > -1 Then
TextBox1.Text = CStr(ComboBox1.SelectedItem)
End If
End Sub
如果您有多个条件,请使用Select Case
Private Sub fy_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles fy.SelectedIndexChanged
If fy.SelectedIndex > -1 Then
Dim comboValue = CInt(fy.SelectedItem)
Select Case comboValue
Case 2400
µmax.Text = 8.56 / 100000 * fcu.Text
Case 2800
µmax.Text = 7 / 100000 * fcu.Text
Case Else
'etc 'etc
End Select
End If
End Sub