Datagrid view
-
hi, i am using datagridview and i am having 4 columns now i want to validate the entry like e.g i should enter numbers in 2'nd column ,text in thied column pls help me. with regards prasad:)
-
hi, i am using datagridview and i am having 4 columns now i want to validate the entry like e.g i should enter numbers in 2'nd column ,text in thied column pls help me. with regards prasad:)
-
hi, i am using datagridview and i am having 4 columns now i want to validate the entry like e.g i should enter numbers in 2'nd column ,text in thied column pls help me. with regards prasad:)
well u can handle this situation without using regular expressions as well. You need to handle the cellValidating event of the DGV and in that u'd code somthin like this.
int i; if(e.ColumnIndex == myDGVCol1.DisplayIndex) { if(!Int32.TryParse(e.FormattedValue,out i)) { e.Cancel = true; MessageBox.Show("It is not an integer"); // or myDGV[e.ColumnIndex, e.RowIndex].ErrorText ="Whatever"; } // similarly u can use the tryparse methods of DateTime classes etc }
and in order to go without taking special charaters u can use string manuipulation but I dont have the sample right now... hope it helps Rocky -
well u can handle this situation without using regular expressions as well. You need to handle the cellValidating event of the DGV and in that u'd code somthin like this.
int i; if(e.ColumnIndex == myDGVCol1.DisplayIndex) { if(!Int32.TryParse(e.FormattedValue,out i)) { e.Cancel = true; MessageBox.Show("It is not an integer"); // or myDGV[e.ColumnIndex, e.RowIndex].ErrorText ="Whatever"; } // similarly u can use the tryparse methods of DateTime classes etc }
and in order to go without taking special charaters u can use string manuipulation but I dont have the sample right now... hope it helps RockyThank u it is working with regards prasad