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
mike Delvotti
NA
262
0
Index was out of range
Mar 8 2012 8:57 AM
I'm getting the following message pop up even though the function works:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name:Index
I think it may be a null issue, but what would be the best way to overcome it on my code below. Basiclly i fill my dataset then databind it to a datagridview, then i hide columns i don't need to be seen in my datagrid, although the datagrid fills fine it throws the above message. my sample code below:
DataSet dsLookup = new DataSet();
dsLookup.ReadXml(response.GetResponseStream());
dataGridView1.DataSource = dsLookup.Tables[0];
dataGridView1.Columns["StockNumber"].DisplayIndex = 0;
dataGridView1.Columns["RegistrationNumber"].DisplayIndex = 1;
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[1].Visible = false;
Reply
Answers (
9
)
Clicking a button a website in c#
Filestreaming System.OutofMemoryException