Results 1 to 7 of 7

Thread: the first array has been checked how do i check the others?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    the first array has been checked how do i check the others?

    ok, i have a code where if a certain array equals the value of a box an event occurs, this works fairly well...

    but what i want to do now is to check if the array is equal to other values in other boxes to make it do another event....


    ill give my code

    VB Code:
    1. If round < 7 Then
    2.     While roundchecker < 4
    3.     If pic_emptyslot(round, roundchecker).Picture = slotname(roundchecker).Picture Then
    4.         Text1.BackColor = vbRed
    5.     End If
    6.     roundchecker = roundchecker + 1
    7.     Wend
    8.     round = round + 1
    9.     colourchecker
    10. roundchecker = 0
    11. End If


    ok so basically pic_emptyslot(round, roundchecker) round is the objects control array (there is alot of these objects) and roundchecker is the different box type...

    anyway that code is fine, but my problem i need help with is this.

    ok roundchecker is an array with 4 integers, now lets say that pic_emptyslot(0,2) is equal to slotname(2) it works fine but i want to also check if

    pic_emptyslot(0,2) is equal to slotname(0)
    pic_emptyslot(0,2) is equal to slotname(1)
    pic_emptyslot(0,2) is equal to slotname(3)


    how do i sucessfully do this? im sure it wouldnt be too hard, its probably just a loop event, i just need a little leg up

  2. #2
    Addicted Member
    Join Date
    Feb 2006
    Location
    Hyderabad, India
    Posts
    233

    Re: the first array has been checked how do i check the others?

    Add the lines that are in bold and make the changes where they are underlined. That should do it.

    VB Code:
    1. If round < 7 Then
    2.     While roundchecker < 4
    3.     [B]for i = 0 to 3 [/B]
    4.       If pic_emptyslot(round, roundchecker).Picture = [U]slotname   (i).[/U]Picture Then
    5.         Text1.BackColor = vbRed
    6.       End If
    7.     [B]next i[/B]  
    8.     roundchecker = roundchecker + 1
    9.     Wend
    10.     round = round + 1
    11.     colourchecker
    12. roundchecker = 0
    13. End If
    Last edited by srisa; Apr 10th, 2006 at 04:03 AM. Reason: forgot to indent properly

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    Re: the first array has been checked how do i check the others?

    also just another question just before i go....

    im trying to use the DragDrop command

    can someone tell me how to get this to work properly?

    pic_emptyslot1(round).Picture = Selected.Picture

    when i press on the other picture its supposed to make selected = the object

    is there any REALLY simple way to do this ?

    such as pic_emptyslot1(round).Picture = lastdragged.picture

    thank you so much to whoever replys

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    Re: the first array has been checked how do i check the others?

    btw, thanks for that reply, can someone help me with this other question?


    soz i didnt read that reply when i posted mine

    EDIT

    also to the post above... are you sure that works?

    for i = 0 to 3
    If pic_emptyslot(round, roundchecker).Picture = slotname (i).Picture Then
    Text1.BackColor = vbRed
    End If

    wont that just check them all? i want ONLY one to be red, and if the others equal a slot which ISNT the same number to be Text1.BackColor = vbBLUE

    Text1.BackColor is just a test its not my real object

  5. #5
    Addicted Member
    Join Date
    Feb 2006
    Location
    Hyderabad, India
    Posts
    233

    Re: the first array has been checked how do i check the others?

    When you click a picturebox its picture should be assigned to another picturebox . Is that what you mean?
    In that case, if selected is the picturebox clicked, then in the click event of that selected picturebox, assign it to whatever picturebox you want.
    Like, in selected_click event
    VB Code:
    1. pic_emptyslot1(round).Picture = selected.picture

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    Re: the first array has been checked how do i check the others?

    yea, ok that seems to be ok...

    can you read my other post now? i would like to know how i will do what i explained in the post above the last post u made

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    Re: the first array has been checked how do i check the others?

    nvm got it

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