开发者

how to control textbox type to double in visual basic?

I'd like to make a textbox that accepts only numbers, but not integer, but rather double.

I've read here about e.Handled = Not Char.IsDigit(e.KeyChar) and it works, but again, it can be used only for integer, since it declines decimal point.

Another thing I've read here is If Not开发者_运维技巧 Double.TryParse(TextBox2.Text, value) Then .... and it would work fine, except that it allows only decimal comma instead of point. I don't know whether it's because of my location settings (Hungary, we use commas instead of points), but I don't have any other idea how to solve my problem, and the SQL server I send my data uses decimal point.

Thanks in advance.


Pass CultureInfo.InvariantCulture to TryParse.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜