0
private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
DataGridViewCell Docnamecell = row.Cells[dataGridView1.Columns[0].Index];
DataGridViewCell Gendercell = row.Cells[dataGridView1.Columns[1].Index];
DataGridViewCell Addresscell = row.Cells[dataGridView1.Columns[2].Index];
DataGridViewCell Contactnocell = row.Cells[dataGridView1.Columns[3].Index];
DataGridViewCell Datecell = row.Cells[dataGridView1.Columns[4].Index];
e.Cancel = !(IsDoc(Docnamecell) && IsGender(Gendercell) && IsAddress(Addresscell) && IsContactno(Contactnocell) && IsDate(Datecell));
e.Cancel = true;
}
private Boolean IsDoc(DataGridViewCell cell)
{
if (cell.Value == null)
{
MessageBox.Show("Enter Docname");
}
return false;
}
private Boolean IsGender(DataGridViewCell cell)
{
if (cell.Value == null)
{
MessageBox.Show("Enter Gender");
return false;
}
return true;
}
private Boolean IsAddress(DataGridViewCell cell)
{
if (cell.Value == null)
{
MessageBox.Show("Enter Address");
return false;
}
return true;
}
private Boolean IsContactno(DataGridViewCell cell)
{
if (cell.Value == null)
{
MessageBox.Show("Enter Contact no");
return false;
}
return true;
}
private Boolean IsDate(DataGridViewCell cell)
{
if (cell.Value == null)
{
MessageBox.Show("Enter Date");
return false;
}
return true;
}
}
Что вы подразумеваете под _васификацией строки_ точно? Не могли бы вы быть более конкретными? –
, если значение ячейки пустое, чем оно не должно идти в новую строку –
, пожалуйста, проверьте мой код и скажите мне коррекцию –