private void dataGridView1_BindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { int rowCount = dataGridView1.RowCount; // do something with the row count }
private void dataGridView1_BindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Success) { // the binding was successful, do something here } else { // the binding failed, handle the error here } }This example shows how to use the DataGridViewBindingCompleteEventArgs to check if the binding was successful. It uses the BindingCompleteState property to determine the success status. Package library: System.Windows.Forms namespace in the System.Windows.Forms.dll assembly.