Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim myString as string = "btn12"
dim integerString as string
integerString = myString.Substring(myString.length - 2)
dim myInteger as integer = cint(integerString)
Private Function GetNumericPart(ByVal MyString As String) As Integer
'the string that'll store the numeric part
Dim resultString As String = String.Empty
'set the default value in case MyString doesn't end with a numeric part
Dim defaultValue As Integer = 0
'Loop through the characters starting from the end
For i As Integer = MyString.Length - 1 To 0 Step -1
' if the character is numeric
If IsNumeric(MyString(i)) Then
'then store it
resultString = MyString(i) & resultString
'else leave
Else : Exit For
End If
Next
'return the numeric part or the defaultValue
If IsNumeric(resultString) Then
Return CInt(resultString)
Else
Return defaultValue
End If
End Function
Imports System.Text.RegularExpressions
Public Class Form1
Inherits System.Windows.Forms.Form
'Windows stuff omitted
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox3.Text = Regex.Match(TextBox2.Text, TextBox1.Text).ToString
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For Each m As Match In Regex.Matches(TextBox2.Text, TextBox1.Text)
TextBox3.Text += m.ToString + ", "
Next
TextBox3.Text = TextBox3.Text.Substring(0, TextBox3.Text.Length - 2)
End Sub
End Class