if (dataGridView1.Rows.Count >= 4) { MessageBox.Show("you cant exceed this number"); }
private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e) { if (dataGridView1.Rows.Count > 4) { dataGridView1.AllowUserToAddRows = false; MessageBox.Show("you cant exceed this number"); } else { dataGridView1.AllowUserToAddRows = true; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)