Connecting labels - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Connecting labels

john henderjohn hender Posts: 4Member
alright i have this project

Private Sub Comman1_click()
Image1.visible = False 'Hide coins
Label1.caption = Int(Rnd *10) 'pick numbers
Label2.caption = Int(Rnd*10)
' if any caption is 7 display coin stack and beep
If (Label1.caption = 7) Or Label2.caption = 7) or Label3.caption = 7)then Image1.visible = True
Beep
End If
End Sub


Its a called a "Lucky Seven" thing where when you click on command 1 it picks random numbers in any of the three labels something like a lottery or something. now for my project it says i have to make all the labels added together = 7 but i tried putting that down Label1.Caption + Label 2.caption+ label 3.caption = 7 it doesnt work. But i think before i can get them added up, i have to somehow link or connect all the labels before i can make them add each other up. any help?

Comments

  • CyGuyCyGuy Posts: 312Member
    : alright i have this project
    :
    : Private Sub Comman1_click()
    : Image1.visible = False 'Hide coins
    : Label1.caption = Int(Rnd *10) 'pick numbers
    : Label2.caption = Int(Rnd*10)
    : ' if any caption is 7 display coin stack and beep
    : If (Label1.caption = 7) Or Label2.caption = 7) or Label3.caption = 7)then Image1.visible = True
    : Beep
    : End If
    : End Sub
    :
    :
    : Its a called a "Lucky Seven" thing where when you click on command 1 it picks random numbers in any of the three labels something like a lottery or something. now for my project it says i have to make all the labels added together = 7 but i tried putting that down Label1.Caption + Label 2.caption+ label 3.caption = 7 it doesnt work. But i think before i can get them added up, i have to somehow link or connect all the labels before i can make them add each other up. any help?
    :
    [green]if the lables must add up to equal 7 then the random number generator is where to look... you are trying to get random numbers from 0-9 that will give you more than 7!!! no you want the first to give you a number from 0 to 7 like = Int (RND * 7) after that the number you want is going to be 0 to (7 - Label1.caption) then you should get Label3.caption = 7 - sum of the other 2 labels... it will always add up to 7 [/green]
  • moneomoneo Posts: 39Member
    : alright i have this project
    :
    : Private Sub Comman1_click()
    : Image1.visible = False 'Hide coins
    : Label1.caption = Int(Rnd *10) 'pick numbers
    : Label2.caption = Int(Rnd*10)
    : ' if any caption is 7 display coin stack and beep
    : If (Label1.caption = 7) Or Label2.caption = 7) or Label3.caption = 7)then Image1.visible = True
    : Beep
    : End If
    : End Sub
    :
    :
    : Its a called a "Lucky Seven" thing where when you click on command 1 it picks random numbers in any of the three labels something like a lottery or something. now for my project it says i have to make all the labels added together = 7 but i tried putting that down Label1.Caption + Label 2.caption+ label 3.caption = 7 it doesnt work. But i think before i can get them added up, i have to somehow link or connect all the labels before i can make them add each other up. any help?
    :
    John,
    Don't forget to do RANDOMIZE TIMER at the top of your program to ensure that you truly get random numbers.
    *****

Sign In or Register to comment.