Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim arr(2) As String
For i = 0 To arr.GetUpperBound(0) - 1
arr(i) = InputBox("input data (" & i & ")")
Next
Dim z As String = ""
For i = 0 To arr.GetUpperBound(0)
z &= arr(i)
If IsNumeric(arr(i)) Then
z &= (" ข้อมูลนี้เป็นตัวเลข " & (", "))
Else
z &= (" ข้อมูลนี้ไม่ใช่ตัวเลข ")
End If
Next
MsgBox("แยกตัวอักษรและตัวเลข ===========>>> { " & z & " }")
End Sub
End Class
Tag : .NET, VS 2008 (.NET 3.x), VS 2010 (.NET 4.x)
Date :
2011-11-30 15:06:11
By :
dekmonojung
View :
4202
Reply :
1
No. 1
Guest
Code (VB.NET)
Dim i, j As Short
Dim arr(1)
For i = 0 To arr.Length - 1
arr(i) = InputBox("input data (" & i & ")")
Next
Dim num, str As String
num = ""
str = ""
For i = 0 To arr.Length - 1
If num <> "" Then num &= ","
If str <> "" Then str &= ","
For j = 1 To Len(arr(i))
If IsNumeric(Mid(arr(i), j, 1)) Then
num &= Mid(arr(i), j, 1)
Else
str &= Mid(arr(i), j, 1)
End If
Next
Next
MsgBox("แยกตัวอักษรและตัวเลข ===========>>> { " & str & "," & num & " }")