Re: DatagridView Validation assistance needed
- From: "ClayB" <clayb@xxxxxxxxxxxxxx>
- Date: 20 Feb 2007 08:06:16 -0800
You can probably avoid your loop problem by setting a flag and only do
the validation when you are not trying to explicitly move to the empty
cell.
bool inValidateMove = false;
void dataGridView1_CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
if (!inValidateMove && e.ColumnIndex != 0 &&
(dataGridView1[0, e.RowIndex].Value == null
|| dataGridView1[0,
e.RowIndex].Value.ToString().Length == 0))
{
MessageBox.Show("Must enter col 0");
e.Cancel = true;
inValidateMove = true;
dataGridView1.CurrentCell = dataGridView1[0,
e.RowIndex];
inValidateMove = false;
}
}
======================
Clay Burch
Syncfusion, Inc.
.
- Follow-Ups:
- Re: DatagridView Validation assistance needed
- From: Spottswoode
- Re: DatagridView Validation assistance needed
- References:
- DatagridView Validation assistance needed
- From: Spottswoode
- DatagridView Validation assistance needed
- Prev by Date: Re: MonthCalendar | How to find the day an object was droped on?
- Next by Date: Re: Urgent: Controls disapearing from Design Surface...
- Previous by thread: DatagridView Validation assistance needed
- Next by thread: Re: DatagridView Validation assistance needed
- Index(es):
Relevant Pages
|