![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] visual basic programming? I'm trying to do an eventHandler for my yahtzee program. When the user clicks a dice I want a label under it to display "hold." This is the procedure I wrote: Sub dice_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pic1.Click, pic2.Click, pic3.Click, pic4.Click, pic5.Click If pic1.Click Then Me.Label1.Text = "Hold" End If End Sub A blue line shows up under pic1.click and says I need a raise event procedure or something. What am I doing wrong? |
| |
| |||
| Use the sender object to determine what picture was clicked. You can create a myPic variable and assignn the sender object to it. Once assigned (myPic = sender) you can read the name or tag property into a string variable and use a select case . Dim myPic as PictureBox myPic = sender strTag = myPic.Tag strName = myPic.name select case strTag case "Die1" labelPic1.text ="'HOLD" case "Die2" ect.... If you use the tag property you will have to load the tags via the properties at design time or load them in run time. |
![]() |
| Thread Tools | |
| Display Modes | |
| |