Need help with dice pictures showing on buttons

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 4346 Views - Last Post: 27 December 2012 - 06:45 PM Rate Topic: -----

#16 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Need help with dice pictures showing on buttons

Posted 26 December 2012 - 03:49 PM

Perhaps now you'd want to re-factor your code, because there's much of repeated lines. You can assign all your dices' values in one loop, and do similar for buttons' background images. And, as posted in answer #11, you can go, and start using Random class. That's all optional of course.
Was This Post Helpful? 0
  • +
  • -

#17 Arctiq  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 23-December 12

Re: Need help with dice pictures showing on buttons

Posted 27 December 2012 - 05:08 PM

Hmm... This is weird. Everytime I open up the program to test it, I hit the roll button and the same dice come up each time? the first and sixth dice are always showing up as 5 the firs time, the second and third dice are showing up as four, and the fourth and fifth dice are showing up as two? And this is every time I start the program and press the roll button once. Also, what's an easy way to make it check to see if certain dice are on the board without doing a bunch of If...Then statements?
Was This Post Helpful? 0
  • +
  • -

#18 Arctiq  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 23-December 12

Re: Need help with dice pictures showing on buttons

Posted 27 December 2012 - 05:45 PM

View PostArctiq, on 27 December 2012 - 05:08 PM, said:

Hmm... This is weird. Everytime I open up the program to test it, I hit the roll button and the same dice come up each time? the first and sixth dice are always showing up as 5 the firs time, the second and third dice are showing up as four, and the fourth and fifth dice are showing up as two? And this is every time I start the program and press the roll button once. Also, what's an easy way to make it check to see if certain dice are on the board without doing a bunch of If...Then statements?


Nevermind... Fixed it... Forgot the "Randomize()" statement at the top of the random number generators.
Was This Post Helpful? 0
  • +
  • -

#19 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2256
  • View blog
  • Posts: 9,444
  • Joined: 29-May 08

Re: Need help with dice pictures showing on buttons

Posted 27 December 2012 - 06:45 PM

So what is the point of you using vb.net if you're going to insist on using vb6 coding.

If did a search or looked at the related topics (which seriously doubt) you have done, you would have found a better way of this.
- Using System.Random
- By creating a class that encapsulate / represent a die. (It could inherit from picture box).
For example
So now all to code related to display the die face is in one place.
- You can have multiple instance of die.
- Create it as it is own library project, then import it into the game project.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2