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' –