hazel

hazel

  • NA
  • 1
  • 1.3k

How do I add the data a user inputs into a datagridview?

Mar 25 2013 11:49 AM
I have a DataGridView which has 1 column. I want the user to add as many rows they need. Then when they move onto the next tab the row is saved. At the moment the user enters the data and can move to next tab and if they go back the data is still there. However when I try to save the data the row count for the DataGridView is 0 and therefore not entering the foreach statement - Foreach (DataRow row in DataGridView1.Rows){}

I'm guessing I need to add the rows but on which event? - UserAddedRow, CellChanged? And how do I do it? I tried loads of different ways & I'm getting nowhere.