I\'m trying to add data as one by one row to a datagridview here is my code and it says:
\"Index was out of range. Must be non-negative and less than
You're not adding columns to your DataGridView
DataGridView dataGridView1 = new DataGridView();//Create new grid
dataGridView1.Columns[0].Name = "ItemID";// refer to column which is not there
Is it clear now why you get an exception?
Add this line before you use columns to fix the error
dataGridView1.ColumnCount = 5;