Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Type only numbers in a DGV column

$
0
0
Hello,

I have a question about how to limit the keyboard entry in a datagridview cell from a certain column. I have found many answers but all are a bit complicated so I wonder if there is a simpler way to do that.

So basically I have a DGV and I need all the cells from a specific column to contain only numbers and the "." sign.

The best way would be to stop the user by inputing any other character, so I would need like a keypress event for that cell...

If Char.IsDigit(e.KeyChar) Or e.KeyChar = ControlChars.Back Or e.KeyChar = "." Then
e.Handled = False
Else
e.Handled = True
End If

How can I do this for a DGV cell?

Thx.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>