Hello, all.
Novice level VB programmer here.
I've got a form that contains a combo box from which the user can select a PC host name. When the host name is selected, the program loops through and performs three functions:
1. enable all check boxes
2. select/clear the appropriate boxes
3. disable selected check boxes (to indicate they are the minimum required)
The problem is that, to me, there seems like there would be more streamlined way to go about the tasks. I dabble mostly with PHP and that sort of thing, so I'm in the mindset of using the DOM where form items are indexed and can be referenced by the form.elements[i] syntax.
Looking for illuminating (and relevant) concepts here.
Thanks!
Dim arrAccounts(,) As String = { _
{"HOST-01", True, False, True, True, False, False, False, False, False, True, False, False, True, False, False, False, False, False, False, False}, _
{"HOST-02", True, False, True, True, False, False, False, False, False, True, False, False, True, False, False, False, True, True, False, False}, _
{"HOST-03", True, False, True, True, False, False, False, False, False, True, False, False, True, False, False, False, False, False, False, False}, _
{"HOST-04", True, False, True, True, False, False, False, False, False, True, False, False, True, False, False, False, True, True, False, False}, _
{"HOST-05", True, False, True, True, False, False, False, False, False, True, False, False, True, False, False, False, True, True, False, False} _
}
For HostName = 0 To (arrAccounts.Length / 21) - 1
If arrAccounts(HostName, 0) = ComboBox1.Text Then
ckFirefox.Enabled = True
ckChrome.Enabled = True
ckClocX.Enabled = True
ckJRE.Enabled = True
ckKronos.Enabled = True
ckWinlink.Enabled = True
ckTokairo.Enabled = True
ckNovarad.Enabled = True
ckCART.Enabled = True
ckAcrobat.Enabled = True
ckEduTracker.Enabled = True
ckStaffing.Enabled = True
ck610.Enabled = True
ck1515.Enabled = True
ck161.Enabled = True
ck1060.Enabled = True
ckBasisAlarm.Enabled = True
ckBasisSys.Enabled = True
ckBasisID.Enabled = True
ckOpOutlook.Enabled = True
ckFirefox.Checked = arrAccounts(HostName, 1)
ckChrome.Checked = arrAccounts(HostName, 2)
ckClocX.Checked = arrAccounts(HostName, 3)
ckJRE.Checked = arrAccounts(HostName, 4)
ckKronos.Checked = arrAccounts(HostName, 5)
ckWinlink.Checked = arrAccounts(HostName, 6)
ckTokairo.Checked = arrAccounts(HostName, 7)
ckNovarad.Checked = arrAccounts(HostName, 8)
ckCART.Checked = arrAccounts(HostName, 9)
ckAcrobat.Checked = arrAccounts(HostName, 10)
ckEduTracker.Checked = arrAccounts(HostName, 11)
ckStaffing.Checked = arrAccounts(HostName, 12)
ck610.Checked = arrAccounts(HostName, 13)
ck1515.Checked = arrAccounts(HostName, 14)
ck161.Checked = arrAccounts(HostName, 15)
ck1060.Checked = arrAccounts(HostName, 16)
ckBasisAlarm.Checked = arrAccounts(HostName, 17)
ckBasisSys.Checked = arrAccounts(HostName, 18)
ckBasisID.Checked = arrAccounts(HostName, 19)
ckOpOutlook.Checked = arrAccounts(HostName, 20)
ckFirefox.Enabled = Not Boolean.Parse(arrAccounts(HostName, 1))
ckChrome.Enabled = Not Boolean.Parse(arrAccounts(HostName, 2))
ckClocX.Enabled = Not Boolean.Parse(arrAccounts(HostName, 3))
ckJRE.Enabled = Not Boolean.Parse(arrAccounts(HostName, 4))
ckKronos.Enabled = Not Boolean.Parse(arrAccounts(HostName, 5))
ckWinlink.Enabled = Not Boolean.Parse(arrAccounts(HostName, 6))
ckTokairo.Enabled = Not Boolean.Parse(arrAccounts(HostName, 7))
ckNovarad.Enabled = Not Boolean.Parse(arrAccounts(HostName, 8))
ckCART.Enabled = Not Boolean.Parse(arrAccounts(HostName, 9))
ckAcrobat.Enabled = Not Boolean.Parse(arrAccounts(HostName, 10))
ckEduTracker.Enabled = Not Boolean.Parse(arrAccounts(HostName, 11))
ckStaffing.Enabled = Not Boolean.Parse(arrAccounts(HostName, 12))
ck610.Enabled = Not Boolean.Parse(arrAccounts(HostName, 13))
ck1515.Enabled = Not Boolean.Parse(arrAccounts(HostName, 14))
ck161.Enabled = Not Boolean.Parse(arrAccounts(HostName, 15))
ck1060.Enabled = Not Boolean.Parse(arrAccounts(HostName, 16))
ckBasisAlarm.Enabled = Not Boolean.Parse(arrAccounts(HostName, 17))
ckBasisSys.Enabled = Not Boolean.Parse(arrAccounts(HostName, 18))
ckBasisID.Enabled = Not Boolean.Parse(arrAccounts(HostName, 19))
ckOpOutlook.Enabled = Not Boolean.Parse(arrAccounts(HostName, 20))
End If
Next