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

Posted by Lacy under C# on 6/5/2012 | Points: 10 | Views : 2924 | Status : [Member] | Replies : 6
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: Sakthi.Singaravel on: 6/5/2012 [Member] Silver | Points: 25
Posted by: Sakthi.Singaravel on: 6/5/2012 [Member] Silver | Points: 25

Up
0
Down
This link also helps to u...

http://social.msdn.microsoft.com/Forums/br/winformsdatacontrols/thread/919b059c-dba9-40d2-bac7-608a9b120336

Regards,
Singaravel M

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

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