IsNumericを使いましょう。
英語の公式から
Public Function IsNumeric(ByVal Expression As Object) As Boolean
Returns a Boolean value indicating whether an expression can be evaluated as a number.
英語読めなくても翻訳サイトで翻訳
すると
リターン 数としての表現への評価ブール値標示 。
Booleanを返すみたいですね。
サンプルソース
——————————————————
Dim testVar As Object
Dim numericCheck As Boolean
testVar = “53”
‘ The following call to IsNumeric returns True.
numericCheck = IsNumeric(testVar)
testVar = “459.95”
‘ The following call to IsNumeric returns True.
numericCheck = IsNumeric(testVar)
testVar = “45 Help”
‘ The following call to IsNumeric returns False.
numericCheck = IsNumeric(testVar)
——————————————————
引数がObjectでBooleanを返すみたいですね。
textboxはオブジェクトなので使えそうですね。
サンプルソース
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If IsNumeric(TextBox1.Text) Then
MsgBox(“数値です”)
Else
MsgBox(“数値ではありません”)
End If
End Sub
End Class
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
簡単ですね。
やれば出来ますね。
やれば出来る子と言われてきたのでw