https://i.stack.imgur.com/3D3xS.png У меня есть 13 выпадающих меню. Для l oop работает (проверяет, не выбираю ли я одно и то же устройство и номер более одного раза). Попытка решить операторы If в конце, проверяя, если при выборе устройства A, B или «канал недоступен», два текстовых поля ввода содержат значения. 1) Если выбрано устройство A, убедитесь, что номер указан в первом поле ввода текста. 2) Если выбрано устройство B, убедитесь, что для второго поля ввода текста указан номер. 3) Убедитесь, что для поля ввода текста устройства a или b указан хотя бы номер. В настоящее время появляются мои сообщения, но когда я нажимаю кнопку «Далее», ничего не происходит? Даже если я ввожу значения в текстовый ввод и нажимаю «Далее», кажется, что ничего не происходит. Я решил, что это структура моих операторов If, мне нужна помощь в создании проверки. Есть мысли?
If (HTSelection.DeviceDropDown1.List(0)) <> Empty Then
Else
DeviceDropDown1.AddItem "Device A: HT 1"
DeviceDropDown1.AddItem "Device A: HT 2"
DeviceDropDown1.AddItem "Device A: HT 3"
DeviceDropDown1.AddItem "Device A: HT 4"
DeviceDropDown1.AddItem "Device A: HT 5"
DeviceDropDown1.AddItem "Device A: HT 6"
DeviceDropDown1.AddItem "Device A: HT 7"
DeviceDropDown1.AddItem "Device A: HT 8"
DeviceDropDown1.AddItem "Device B: HT 1"
DeviceDropDown1.AddItem "Device B: HT 2"
DeviceDropDown1.AddItem "Device B: HT 3"
DeviceDropDown1.AddItem "Device B: HT 4"
DeviceDropDown1.AddItem "Device B: HT 5"
DeviceDropDown1.AddItem "Device B: HT 6"
DeviceDropDown1.AddItem "Device B: HT 7"
DeviceDropDown1.AddItem "Device B: HT 8"
DeviceDropDown1.AddItem "Channel_Not_Available"
End If
End Sub
Private Sub HTNextButton_Click()
On Error Resume Next
DDi = 1
DDj = 1
Numberflag = 0
DeviceFlagA = 0
DeviceFlagB = 0
For DDi = 1 To 13
Device = Me.Controls.Item("DeviceDropDown" & DDi)
If Device = "Channel_Not_Available" Then
ElseIf Device = "Select Device" Then
MsgBox "Please select Number channel for Device" & DDi, vbCritical, "Error"
Exit For
Else
If InStr(1, Device, "Device A") Then
DeviceFlagA = 1
End If
If InStr(1, Device, "Device B") Then
DeviceFlagB = 1
End If
For DDj = 1 To 13
If DDi <> DDj Then
Device1 = Me.Controls.Item("DeviceDropDown" & DDj)
If Device1 = "Channel_Not_Available" Then
Else
If Device = Device1 Then
MsgBox "Please select different number for Device" & DDj, vbCritical, "Error"
Numberflag = Numberflag + 1
Exit For
End If
End If
End If
Next
If Numberflag >= 1 Then
Exit For
End If
End If
Next
If DeviceFlagA = 1 Then
If HTSelection.DeviceSAInput.Text <> Empty Then
Else
MsgBox "Please enter valid number for device A", vbCritical, "Error"
End If
If DeviceFlagB = 1 Then
If HTSelection.DeviceSAInputB.Text <> Empty Then
Else
MsgBox "Please enter valid number for device B", vbCritical, "Error"
End If
If Numberflag = 0 Then
If (HTSelection.DeviceSAInput.Text <> Empty Or HTSelection.DeviceSAInputB <> Empty) Then
Number = HTSelection.DeviceSAInput.Text
Numberb = HTSelection.DeviceSAInputB.Text
Set clientNumber = CreateObject("Device.usb")
Set clientNumberb = CreateObject("Deviceb.usb")
End If
Me.Hide
Chart.Show
Else
MsgBox "Please enter valid number", vbCritical, "Error"
End If
End If
End Sub