My problem is as fallows, I want to add elements to an array, for that, I created a textbox wich would add the elements to the array,my code is as fallows:
int[] table = new int[24];
private void btnInput_Click(object sender, EventArgs e)
{
int elem = 0;
for (int i = 0; i < table.Length; i++)
{
if (i < table.Length)
{
tabla[elem] = Convert.ToInt32(txtEntrada.Text);//Input string was not in a correct format
txtEntrada.Clear();
}
else if (i==tabla.Length)
{
MessageBox.Show("Array full");
}
}
}
How ever, I get a code error while debugging, it says that the input string was not in correct format, which I don't understand why since I converted to int32, can someone please guide me as how can I fix this issue?
Hope someone can help me out with this, many thanks.
How ever, I get a code error while debugging, it says that the input string was not in correct format, which I don't understand why since I converted to int32, can someone please guide me as how can I fix this issue?
Hope someone can help me out with this, many thanks.
VulpesPosted Nov 12, 2011, 5:07 PM
See if this is any better:
Riemann HarrisonPosted Nov 12, 2011, 5:43 PM
Riemann HarrisonPosted Nov 12, 2011, 4:52 PM
I still have some errors though, but I'm working on them, if you can provide me some hint, it would be welcome.
VulpesPosted Nov 12, 2011, 4:48 PM
One possibility is that it includes a thousand separator or a decimal point.
Could that be the case here?