|
-
Dec 22nd, 2011, 02:42 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] array problem again
hey yall what i need to do is replace player2 with another array
do i dim it as string and if i do i get a miss match error
what ive tryed is this
dim names as string
names="player3"
if form1.names(x).tag=s then
Code:
if form1.player2(x).tag=s then
endif
-
Dec 22nd, 2011, 02:46 AM
#2
Re: array problem again
Presumably 'players' is a UDT array so I'd expect 'names' to be a similar UDT array
-
Dec 22nd, 2011, 03:25 AM
#3
Thread Starter
Fanatic Member
Re: array problem again
thanks doogle
player2(x) is a picturebox does that matter
-
Dec 22nd, 2011, 05:20 AM
#4
Thread Starter
Fanatic Member
Re: array problem again
am i using the wrong methed to change just the word player2 into player3 or player4
thanks
-
Dec 22nd, 2011, 05:46 AM
#5
Frenzied Member
Re: array problem again
anything that you access witth a dot is an thing with properties
so
formbits are called foemname.bitname
players.tag the tag needs something to be placed on
so
type player
name as string
tag as integer
etc...
end type
would suffice
now you can put your players into an array
dim players(22) as player
thats the football teams in a match dealt with ... note no substitutes and the manager is not allowed on the pitch!
OH english football!
hope that helps
here to talk
-
Dec 22nd, 2011, 06:24 AM
#6
Thread Starter
Fanatic Member
Re: array problem again
the only way i could get it to work is
dim names as string
names=form1.player3(x).tag
if names=s then
endif
i guess thatall work
thanks
-
Dec 22nd, 2011, 08:24 AM
#7
Frenzied Member
Re: array problem again
looks like a work around but not a real fix for the code
oh well
here to talk
-
Dec 22nd, 2011, 11:31 AM
#8
Thread Starter
Fanatic Member
Re: array problem again
it want realy work that way
ok start over again
what i have is .
they all have an index 0 and 1.
i cant change the names of all of them to players(1 to 10)
Code:
if form1.player2(x).tag=s
endif
if form1.player3(x).tag=s
endif
if form1.player4(x).tag=s
endif
if form1.player5(x).tag=s
endif
-
Dec 22nd, 2011, 11:54 AM
#9
Thread Starter
Fanatic Member
Re: array problem again
in a module
i have all of player2 .
so to keep from make 8 copys i need to switch to player2 - player8 ive tried udt im getting errors of course
Code:
For x = 0 To 1
If Val(Form1.player2(x).Tag) = 13 Or Val(Form1.player2(x).Tag) = 26 Or Val(Form1.player2(x).Tag) = 39 Or Val(Form1.player2(x).Tag) = 52 Then
holdsum = holdsum + 1
End If
Next x
-
Dec 22nd, 2011, 12:58 PM
#10
Thread Starter
Fanatic Member
Re: array problem again
thanks yall it was udt i had to put two fake picture boxs on form1 worked like a charm
-
Dec 22nd, 2011, 01:02 PM
#11
Frenzied Member
Re: [RESOLVED] array problem again
still have absolutely no idea what all this was about but glad we could help.
here to talk
-
Dec 22nd, 2011, 01:34 PM
#12
Re: [RESOLVED] array problem again
Hey flyhigh, may I ask what game you are making? I can help ya with anything game related as I am the game expert in these forums. I also have many game examples and tutorials in my sig as well.
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
|