1
如何使txtamount.text
只接受十進制值,它應該只接受一個.
不超過一個。TextBox.Text只接受十進制輸入
我的下面是我的嘗試,但接受更.
Private Sub txtamount_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtamount.KeyPress
If Asc(e.KeyChar) <> 8 Then
If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 46 Then
e.Handled = True
End If
End If
End Sub
使用'NumericUpDown'而不是'TextBox' –