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.

Recommended Answers

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.

Jump to Post

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.

Jump to Post

All 5 Replies

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++;
                }
            }

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.