29-06-14, 02:35 PM
السلام عليكم ورحمة الله وبركاته
بالتعدل علي كودك:
باستخدام الركجس (Regex):
****
***
**
*
بالتعدل علي كودك:
كود :
Dim myString As String = DGV.Rows(0).Cells(2).Value.ToString
Dim number = myString.Split(" "c).Where(Function(f) IsNumeric(f)).ToList
For Each num In number
MsgBox(num)
Nextباستخدام الركجس (Regex):
كود :
Dim Patren As String = "((\d+)? – (\d+)?)" ' هذا التشكيل للبحث عن الأرقام فقط
Dim txtBox As String = DGV.Rows(0).Cells(2).Value.ToString
Dim match As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(txtBox, Patren, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
If match.Count > 0 Then
Dim f As String = match.Item(0).Groups(0).Value
Dim s() As String = f.Split("–")
MsgBox(s(0))
MsgBox(s(1))
End If****
***
**
*

