0

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.

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by mzdravkova
0

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.

0

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.

0

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 by pyTony: fixed formating

0

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.

0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.