The inconvenience occurs when I try to display the content of my array
in a Label
.
The data I try to display of array
comes from a TextBox
, and they are numeric, since basically what I did was try that when the user enters numbers in a TextBox
(separated each one by commas) , create a array
, and with Split
, isolate those numbers and save them in said array
, then go through each space, and save each value in a variable and finally display in a Label
said values.
Apparently it's fine, but when running I have the following error:
System.FormatException: 'Input string was not in a correct format.'
I do not know what could be wrong, so if someone can help me, it would be very useful for me.
This is my code:
int[] A = txtVA.Text.Split(',').Select(Int32.Parse).ToArray();
int[] B = txtVB.Text.Split(',').Select(Int32.Parse).ToArray();
string cadena=" ";
for (int i = 0; i < 2; i++)
{
cadena = Convert.ToString(A[i]);
cadena += cadena;
}
lblre.Text = cadena;