vb2005 textbox 限制輸入類型

2009-01-31 9:25 am
點樣防止user輸入非integer的input?

回答 (1)

2009-01-31 1:03 pm
✔ 最佳答案
Try:


Private Sub textBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

If Char.IsDigit(e.KeyChar) Or (e.KeyChar) = vbBack Then

'Numbers and BackSpace only

Else
e.Handled = True

End If

End Sub


收錄日期: 2021-04-13 16:23:47
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090131000051KK00154

檢視 Wayback Machine 備份