How to click and store picture boxes?

wwonder692

New member
Joined
Dec 9, 2022
Messages
1
Programming Experience
Beginner
I am trying to code Yahtzee. However, one of m task is to click a picture box (dice) if I want to keep it. Else, the dice will roll again. Can someone help please code it in vb.net or atleast give me a hint/step/or guide as to how I can do it.
 
One of the main reasons that beginners can't solve problems is that they expect to be able to go from a vague idea in their head directly to code. You should not even be thinking about writing code until you know what it has to actually do. That doesn't just mean the end result; it means the steps to get there. You need to put some thought into the logic first and only when you have logic that you have successfully tested manually - maybe with pen and paper or maybe some other way - should you then write code. The code should explicitly implement that logic.

You presumably have an array or collection of objects that represent your dice. What do you need to determine whether to roll each die? A Booloean value, right? True to roll and False to keep or vice versa, right? That means that you need to either extend the objects you already have with a Boolean property or else create a new array or collection of the same size that contains Booleans. When you select a PictureBox to keep a die, you set the flag at the corresponding index.

As for the controls, do you know how to do something when the user clicks a Button? Why should clicking a PictureBox or any other control be any different?
 
Back
Top