Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So basically I have to ask the user to input the text in the textBox and then , add that input into the matrix, but the code i have written doesn't give me time to get the user input

What I have tried:

C#
<pre> public    void   FillMatrix (string [,] v)
        {
            for (int i = 2; i <= 4; i+=2)
            {
                for (int j = 2; j <= 4; j++)
                {
                    lblFute.Text = "Write the number on index " + i + " " + j;

                    v[i, j] = txtVlera.Text;
                    if (j == 3 )
                    {
                        lblFute.Text = "Write the number on index  " + j + " " + i;

                        v[j, i] = txtVlera.Text;
                    }
                }
            }
Posted
Updated 15-Apr-20 4:23am
Comments
Richard MacCutchan 15-Apr-20 11:12am    
It may be easier to ask for all the numbers in a row. You can then use the TextChanged event to check when all the values have been entered. You can then ensure that you do not ask for more data until you are ready for it.

1 solution

Here is a similar question, the trick is to use a button and add the values to the array after the button is clicked: Get input from a textbox to an array in C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900