How to filter or validate the input in datagridview's specific column?

Posted by Lacy under C# on 6/5/2012 | Points: 10 | Views : 3148 | Status : [Member] | Replies : 4
Hello guys,
Can some one help me to filter or validate the input in datagridview's specific column? I In my case I just want the user to input only numbers.


Thanks in advance!
Lacy




Responses

Posted by: Ajay.Kalol on: 6/6/2012 [Member] Starter | Points: 25

Up
0
Down
Try Simple Code,

private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)

{
try
{
if (e.FormattedValue.ToString() != "")
{
int i = Convert.ToInt32(e.FormattedValue);
}
}
catch {
MessageBox.Show("Please insert Numeric Value only.");
}
}


Ajay
ajaypatelfromsanthal.blogspot.in

Lacy, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lacy on: 6/6/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks for your reply!

Lacy, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Lacy,
If you found your answer then please Mark it as Answer,


Ajay
ajaypatelfromsanthal.blogspot.in

Lacy, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lacy on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
Ok, thanks!

Lacy, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response