返回列表 上一主題 發帖

[發問] 如何使用 IsNumber(TextBox1)?

回復 1# yangjie

If TextBox1 <> "" And CStr(Val(TextBox1.Value)) <> TextBox1 Then MsgBox "必須輸入為數值": TextBox1 = ""
學海無涯_不恥下問

TOP

回復 3# yangjie
你是用在TextBox1_Change事件內吧
這樣當你輸入小數點時,會出錯
改成
If TextBox1 <> "" And CStr(Val(TextBox1.Value)) <> IIf(Right(TextBox1, 1) = ".", Replace(TextBox1, ".", ""), TextBox1) Then MsgBox "必須輸入為數值": TextBox1 = ""
學海無涯_不恥下問

TOP

        靜思自在 : 並非有錢魷是快樂,問心無愧心最安。
返回列表 上一主題