Answer the question
In order to leave comments, you need to log in
How to convert numeric elements to array in textBox?
Given 2 textboxes and a listbox where an array of numbers is displayed. In 2 textboxes, you need to enter numbers, in other words, numbers from which the number of positive and negative random numbers is converted. How can I code such a cumbersome thing, please tell me.
int a;
int b;
int N = a + b;
int[] mas = new int[10];
int[] mas2 = new int[10];
Random rnd = new Random();
private void button1_Click(object sender, EventArgs e)
{
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
for (int i = 0; i < N; i++)
{
mas[i] = rnd.Next(0, 11) ;
listBox1.Items.Add(mas[i].ToString());
mas2[i] = rnd.Next(0, -11);
listBox1.Items.Add(mas[i].ToString());
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question