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
kindra dragon
NA
6
0
Random Class
Mar 22 2008 9:44 AM
Hey all,
I am having trouble with one of my programs im trying to make with random class. I am a begginer of C# and was wondering if someone can point me in the right direction.
Random x = new Random();
int randomNumber = x.Next(1, 5);
labelNumber.Text +=
randomNumber + "";
That is my code to generate a number so I can assign it to an if statement eg.
if ( labelNumber = 1)
outputBox.Text = "You won"
etc. etc.
I cant get it to work because it says
Error 1 Cannot implicitly convert type 'int' to 'System.Windows.Forms.Label'
Error 2 Cannot implicitly convert type 'System.Windows.Forms.Label' to 'bool'
If anyone can help me I would really appreciate it.
Thanks!!
Reply
Answers (
5
)
How can I make the eventhandler SelectedIndexChance (from a ListView) public in a selfmade UserControl ?
Parsing XML dict file using xlinq