Results 1 to 12 of 12

Thread: [RESOLVED] array problem again

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    Resolved [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

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: array problem again

    Presumably 'players' is a UDT array so I'd expect 'names' to be a similar UDT array

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    Re: array problem again

    thanks doogle
    player2(x) is a picturebox does that matter

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    Re: array problem again

    am i using the wrong methed to change just the word player2 into player3 or player4
    thanks

  5. #5
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    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

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    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

  7. #7
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: array problem again

    looks like a work around but not a real fix for the code

    oh well

    here to talk

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    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

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    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

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2009
    Posts
    573

    Re: array problem again

    thanks yall it was udt i had to put two fake picture boxs on form1 worked like a charm

  11. #11
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: [RESOLVED] array problem again

    still have absolutely no idea what all this was about but glad we could help.

    here to talk

  12. #12
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    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
  •  



Click Here to Expand Forum to Full Width