|
-
Mar 7th, 2001, 10:42 AM
#1
Thread Starter
Hyperactive Member
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
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Mar 7th, 2001, 10:46 AM
#2
Thread Starter
Hyperactive Member
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.
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Mar 7th, 2001, 10:52 AM
#3
Lively Member
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....
-
Mar 7th, 2001, 10:59 AM
#4
Addicted Member
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
-
Mar 7th, 2001, 11:55 AM
#5
Thread Starter
Hyperactive Member
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
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Mar 7th, 2001, 12:16 PM
#6
Addicted Member
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.
-
Mar 7th, 2001, 12:16 PM
#7
Thread Starter
Hyperactive Member
thanks for your help.
It works great now
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Mar 7th, 2001, 12:18 PM
#8
Addicted Member
Yay! It feels so great to help someone; I'm a really new VB programmer (~6 months), so I feel like I'm progressing!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|