Im just learning C# at uni and seem to be struggling to get this random number to out put in a textbox. I havnt learnt a language before this so apologies if its a simple question.
I want to create 5 random numbers, between two different numbers specified by the user. Then print the 5 numbers generated into a textbox to display them.
private void button1_Click(object sender, EventArgs e) {
int firstnum = Int32.Parse(txtboxnum.Text);
int secondnum = Int32.Parse(txtboxnum2.Text);
Random random = new Random();
int randomNumber = random.Next(firstnum, secondnum);
Int32 loop = 0;
do
{
loop++;
}
while (loop > 5);
string myString = randomNumber.ToString();
string txtboxanswer = myString;
I would be much appreciative of any suggestions where im going wrong. As i just cant seem to get the answer to appear in my textbox. I know i must be close. I hope :)
Thanks for all help in advance.