I want to get user's input on how many rows he/she wants and then add that number of rows to the datagridview, while the datagridview is being populated with it's data. This way an ecxeption occurs,System.InvalidOperationException. Is there a work around for this?
int numberOfRows = Int32.Parse(txt_numberofrows.Text.Trim());
for (var i = 1; i < numberOfRows; i++)
{
expenseList.Rows.Add(numberOfRows);
}