Click here to Skip to main content
15,918,967 members
Home / Discussions / C#
   

C#

 
QuestionContent Base Retrivel of Audio & Vedio Data Pin
Muhammad Chitrali15-Oct-06 6:08
Muhammad Chitrali15-Oct-06 6:08 
AnswerRe: Content Base Retrivel of Audio & Vedio Data Pin
Amar Chaudhary15-Oct-06 15:00
Amar Chaudhary15-Oct-06 15:00 
Questionhow to put text in 50 labels Pin
Yustme15-Oct-06 2:33
Yustme15-Oct-06 2:33 
AnswerRe: how to put text in 50 labels Pin
Anthony Mushrow15-Oct-06 2:57
professionalAnthony Mushrow15-Oct-06 2:57 
GeneralRe: how to put text in 50 labels Pin
Yustme15-Oct-06 3:08
Yustme15-Oct-06 3:08 
GeneralRe: how to put text in 50 labels [modified] Pin
Anthony Mushrow15-Oct-06 3:17
professionalAnthony Mushrow15-Oct-06 3:17 
GeneralRe: how to put text in 50 labels Pin
Yustme15-Oct-06 3:31
Yustme15-Oct-06 3:31 
GeneralRe: how to put text in 50 labels Pin
Anthony Mushrow15-Oct-06 3:48
professionalAnthony Mushrow15-Oct-06 3:48 
The (0, 20) cannot be random, and if it was it would be pointless.

int n1 = rnd.Next(0, 51);
int n2 = rnd.Next(0, 51);

n1+n2 would never be greater than 100, and the lowest would be 0, but the answer could be anything inbetween.

As for storing the answerm you can put it in the tag, and check it later

Random rnd = new Random();<br />
<br />
foreach(Control label in this.Controls)<br />
{<br />
if(label.GetType().ToString() == "System.Windows.Forms.Label")<br />
{<br />
int n1 = rnd.Next(0, 20);<br />
int n2 = rnd.Next(0, 20);<br />
int answer = n1+n2;<br />
<br />
label.Tag = answer;<br />
label.Text = n1 + " + " + n2 + " =";<br />
}<br />
}<br />


You'd have to make sure that each text box was referencing the right label though, if you keep all the default names the textBox1 should reference label1

To get the answer back to check it simply:

int answer = (int)label1.Tag;
GeneralRe: how to put text in 50 labels Pin
Yustme15-Oct-06 4:11
Yustme15-Oct-06 4:11 
GeneralRe: how to put text in 50 labels Pin
Yustme15-Oct-06 10:01
Yustme15-Oct-06 10:01 
GeneralRe: how to put text in 50 labels Pin
Tim Paaschen15-Oct-06 20:55
Tim Paaschen15-Oct-06 20:55 
GeneralRe: how to put text in 50 labels Pin
Yustme16-Oct-06 0:24
Yustme16-Oct-06 0:24 
QuestionSending data via IP or MAC address - help [modified] Pin
Anthony Mushrow15-Oct-06 2:18
professionalAnthony Mushrow15-Oct-06 2:18 
AnswerRe: Sending data via IP or MAC address - help Pin
Rob Graham15-Oct-06 3:46
Rob Graham15-Oct-06 3:46 
GeneralRe: Sending data via IP or MAC address - help Pin
Anthony Mushrow15-Oct-06 3:53
professionalAnthony Mushrow15-Oct-06 3:53 
GeneralRe: Sending data via IP or MAC address - help Pin
Nader Elshehabi15-Oct-06 6:00
Nader Elshehabi15-Oct-06 6:00 
QuestionSimple Threading headache Pin
XTr1NiTy14-Oct-06 22:00
XTr1NiTy14-Oct-06 22:00 
AnswerRe: Simple Threading headache Pin
Corinna John14-Oct-06 23:43
Corinna John14-Oct-06 23:43 
GeneralRe: Simple Threading headache Pin
XTr1NiTy15-Oct-06 0:08
XTr1NiTy15-Oct-06 0:08 
QuestionProblem ion Creating XML FIles Pin
farhan197614-Oct-06 21:37
farhan197614-Oct-06 21:37 
AnswerRe: Problem ion Creating XML Files Pin
Larantz15-Oct-06 3:06
Larantz15-Oct-06 3:06 
QuestionHow can I list all functions in a Win32 dll? Pin
Igor Lima14-Oct-06 20:50
Igor Lima14-Oct-06 20:50 
AnswerRe: How can I list all functions in a Win32 dll? Pin
Corinna John14-Oct-06 22:36
Corinna John14-Oct-06 22:36 
AnswerRe: How can I list all functions in a Win32 dll? Pin
Dave Kreskowiak15-Oct-06 4:09
mveDave Kreskowiak15-Oct-06 4:09 
Questionmulti dimension array in an attribute Pin
Thomas Guilbault14-Oct-06 20:33
Thomas Guilbault14-Oct-06 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.