-
we have a new person here who did the User interface work.
This work, consists of 151 or so check boxes and labels.
these are setup in a control array.
Here is the problem
I loop through the array.
The person doing the user interface deleted some labels and created new ones.
I get an error that element 15, or 26, or 48, or 73, or 89, or 91, or 108, or 141 does not exist.
is there anyway to get VB to reassign the array numbers? I don't care what the order is, I just need consecutive numbers.
Thank you for your time and have a good day
-
here is the code I am trying to make work, but the loop never runs.
Code:
On Error Resume Next
For i = 0 To Check1.UBound
If Check1(i).Value = True Then
If Err Then
Err.Clear
GoTo TryAgain
End If
ObjAcad.ActiveDocument.Open ("P:\details\plbg\" & Check1(i).Tag)
ObjAcad.ActiveDocument.SendCommand ("(setq pntr " & Chr(34) & pntr & Chr(34) & ") ")
ObjAcad.ActiveDocument.SendCommand ("filedia 0 ")
ObjAcad.ActiveDocument.SendCommand _
("(load " & Chr(34) & "l:/homegrp/mep/cad/programs/prntdets.lsp" & Chr(34) & ") ")
ObjAcad.ActiveDocument.SendCommand ("(c:prntdets) ")
Check1(i).Value = False
End If
TryAgain:
Next i
the heart of the loop does stuff with autocad, (it works). I just never run the code in the loop.
-
What about getting to the root of the problem and creating a little app to go through the form module and renumbering the controls manually?
Code:
'Check for "Begin VB.CheckBox cbArray"
'Change the line Index = X to something else
Quick and Dirty....
-
How about . . .
Dim ctl as Control
For Each ctl in Me.Controls
If Typeof ctl is CheckBox Then
If ctl.Value = True then
<Do your thing>
End If
End If
Next ctl
-
how can I tell what number in the array the check box is?
If the check box is number 30 in the array I need to know so that I can reference number 30 in the label array.
thank you for your time and have a good day
-
Dim ctl as Control
Dim Index as Integer
For Each ctl in Me.Controls
If Typeof ctl is CheckBox Then
If ctl.Value = True then
Index = ctl.index
Debug.Print Index <Or do whatever with the Index>
<Do your thing>
End If
End If
Next ctl
If you have other checkboxes on the form that aren't part of the array, you might run into some problems. But those are easy enough to work around. Let me know if that's the case.
-
thanks for your help.
It works great now
-
Yay! It feels so great to help someone; I'm a really new VB programmer (~6 months), so I feel like I'm progressing!