Public int nprex = -1; // Initialization position variable x
Public int nprey = -1; // Initialization position variable Y
Private bool bchangecell = true; // flag
Private void DataGrid_currentcellchanged (Object Sender, System.EventArgs E)
{
IF (bchangecell == true)
{
IF (nprex! = this.currentcell.rownumber || nprey! = this.currentcell.columnnnumber)
{
IF (nprex == - 1 && nprey == - 1)
{
nprex = this.currentcell.rownumber;
nprey = this.currentcell.columnnnumber;
Return;
}
IF (this [nprex, nprey] .tostring (). Length <5)
{
Messagebox.show ("error");
BChangeCell = false;
this.currentcell = new dataGridcell (nprex, nprey);
Return;
}
Else
{
nprex = this.currentcell.rownumber;
nprey = this.currentcell.columnnnumber;
}
}
}
Else
BChangeCell = True;
}