I have some problem with this in the textbox must have 6 rows and 7 columns numbers and with button click the numbers must be in diferent 42 labels.

If you split the text from the TextBox by spaces and carriage-return and linefeed, you will get 42 elements that can be put into your labels.

If you split the text from the TextBox by spaces and carriage-return and linefeed, you will get 42 elements that can be put into your labels.

ok i do that but something in my code is wrong because my first column from textbox in the lables is row.so please if you have some code for help.

ok i do that but something in my code is wrong because my first column from textbox in the lables is row.so please if you have some code for help.

here is my code

string[] row = txtVnes.Text.Split('\n');
            int m = 0;
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 7; i++)
                {
                    labeli[i].Text = row[i].ToString();
                    m++;
                }
            }

Edited 3 Years Ago by pyTony: fixed formating

Change your split to also do spaces and you'll have the 42 elements in the array.

" \n\r".ToCharArray()

You can also use the StringSplitOptions to remove any empty entries.

Change your split to also do spaces and you'll have the 42 elements in the array.

" \n\r".ToCharArray()

You can also use the StringSplitOptions to remove any empty entries.

ok thank you so much :)

This article has been dead for over six months. Start a new discussion instead.