TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Riemann Harrison
NA
5
3.8k
Help with "Input string was not in a correct format" error
Nov 12 2011 4:17 PM
Hi, first of all, I wanna thank this helpful forum which seeks to aid those of us who are just getting started with the world of programming.
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.
Reply
Answers (
4
)
C# and SQL question
Interface and abstract class