2个组合框,如果您选择或者选择下拉列表并选择50,我希望其他cbo依赖于该选项并自动填写剩余的(50)。
这是我的代码
Public Class
Dim minus() As integer = {100D}
Dim answers(3) As Integer
Dim cbo() As ComboBox
Form Load;
cbo = New ComboBox() {cbopercentmain, cbopercentpro}
Private Sub cbompercentmain_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbopercentmain.SelectedIndexChanged
Dim cbo As ComboBox = DirectCast(sender, ComboBox)
If cbo.SelectedIndex = -1 Then
answers(Array.IndexOf(comboboxes, cbo)) = 0
Else
answers(Array.IndexOf(comboboxes, cbo)) = CInt(cbo.Text) - minus(Array.IndexOf(comboboxes, cbo))
End If
cbopercentpro.Text = answers.Sum.ToString
End Sub
任何帮助将不胜感激!