如何在VB.NET中的文本框中輸入三位數字後僅允許小數點?在VB.NET文本框中輸入三位數字後只允許有一個小數點?
比方說,我輸入「123」之後,我只能放一個小數,否則不會允許任何其他輸入。所以結果會是「123」。
Dim KeyAscii As Integer
KeyAscii = Asc(myE.KeyChar)
Select Case KeyAscii
Case Asc("0") To Asc("9"), Asc(ControlChars.Back)
myE.Handled = False
Case Asc(".")
If InStr(myTextbox.Text, ".") = 0 Then
myE.Handled = False
Else : myE.Handled = True
End If
Case myE.KeyChar = Chr(127)
myE.Handled = False
Case Else
myE.Handled = True
End Select
Metro?的WinForms? WPF? Silverlight的? ASP.Net? MonoTouch的? – SLaks
它是一個Windows應用程序。在Visual Studio中使用vb.net – Kurusu
WinForms或WPF或Metro? – SLaks