|
-
Nov 21st, 2004, 07:53 PM
#1
Thread Starter
Hyperactive Member
Control array help.....[RESOLVED]
[sigh] i need more help with control arrays, and cant find my answer anywhere.
VB Code:
private sub stuff
dim number as integer
for number = 1 to shape1.ubound
code
code
code
next number
end sub
How would i go about setting up that code so that when the control array element doesnt exist it goes to "next number"
Last edited by psycopatchet69; Nov 21st, 2004 at 08:31 PM.
-
Nov 21st, 2004, 07:57 PM
#2
Frenzied Member
You could try..
VB Code:
private sub stuff
dim number as integer
for number = 1 to shape1.ubound
On Error Goto a1
code
code
code
a1:
next number
end sub
-
Nov 21st, 2004, 08:00 PM
#3
VB Code:
Dim ctl As Shape1
For Each ctl In Shape1
'blah
Next
-
Nov 21st, 2004, 08:07 PM
#4
Thread Starter
Hyperactive Member
No, that still doesnt work, David, i tried to do what you told me, martinliss, and i just dont know what youre even saying, and it didnt work....Here, ill be a little more specific with my code - try to help please.
Oh, mousex1 and mousey1 are just the mousex and y, i have my own system of getting the mouse x and y.
Code:
Private Sub Back_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim number As Integer
For number = 1 To Shape1.ubound
If Mousex1 > Shape1(number).Left + 10 And Mousex1 < Shape1(number).Left + 78 Then
If Mousey1 > Shape1(number).Top + 40 And Mousey1 < Shape1(number).Top + 98 Then
Unload Shape1(number)
Score = Score + 1
End If
End If
Next number
End Sub
-
Nov 21st, 2004, 08:13 PM
#5
Frenzied Member
Martin means something like this....
VB Code:
Private Sub Back_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim number As Integer
Dim ctl As Shape1
For Each ctl In Shape1()
number = ctl.Index
If Mousex1 > Shape1(number).Left + 10 And Mousex1 < Shape1(number).Left + 78 Then
If Mousey1 > Shape1(number).Top + 40 And Mousey1 < Shape1(number).Top + 98 Then
Unload Shape1(number)
Score = Score + 1
End If
End If
Next
End Sub
-
Nov 21st, 2004, 08:18 PM
#6
Thread Starter
Hyperactive Member
I just now tried that code, and now i get an error "User defined type not defined" in the line of "dim ctl as shape1"
-
Nov 21st, 2004, 08:21 PM
#7
Frenzied Member
Oops - wrong type def for Shape1. here try this
VB Code:
Private Sub Back_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim number As Integer
Dim ctl As Shape
For Each ctl In Shape1()
number = ctl.Index
If Mousex1 > Shape1(number).Left + 10 And Mousex1 < Shape1(number).Left + 78 Then
If Mousey1 > Shape1(number).Top + 40 And Mousey1 < Shape1(number).Top + 98 Then
Unload Shape1(number)
Score = Score + 1
End If
End If
Next
End Sub
-
Nov 21st, 2004, 08:22 PM
#8
Frenzied Member
Or if that doesn't work, just use
and let VB sort out the types for itself.
-
Nov 21st, 2004, 08:24 PM
#9
Thread Starter
Hyperactive Member
No, it worked, and thank you, it solved my problem
-
Nov 21st, 2004, 08:28 PM
#10
Frenzied Member
It helps when actual code is posted. Don't forget to edit your first post and put the the tick in the message icon box for resolved
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
|