TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
meng
NA
24
19.7k
get random number
Oct 5 2012 7:28 PM
Hi,
I am trying to generate two different random numbers to display two different dice numbers on two image controls. The btn click event had the following code(below), every time I click the btn click event, both image controls show the same dice number. Please advise how to display different dice numbers on each image control?
Example, imgDDiceOne.Image will show dice number 5, imgDDiceOne.Image will show dice number 1.
Random
rd1 =
new
Random
();
Random
rd2 =
new
Random
();
int
rol1 = rd1.Next(1, 6);
int
rol2 = rd2.Next(1, 6);
imgDDiceOne.Image =
Image
.FromFile(filepath +
"die-"
+ rol1.ToString() +
".gif"
);
imgDDiceTwo.Image =
Image
.FromFile(filepath +
"die-"
+ rol2.ToString() +
".gif"
);
thanks
Reply
Answers (
5
)
C# search directory path
C# Software edit/upgrade