Wednesday, November 26, 2014

When text in textbox starts with , then

Hello,


Refer the code given below. Its working great as per your Requirement.



Public Class Form2
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim YourString As String = TextBox1.Text
TextBox2.Text = YourString.Substring(0, 4) 'Extracting First Four characters to check
Dim d As String
d = TextBox2.Text
If IsNumeric(d) = True Then 'Checking whether first four characters are Numeric value or not
TextBox3.Text = TextBox1.Text 'Display the Result
Else
TextBox3.Text = YourString.Remove(0, 4)
End If
End Sub
End Class


No comments:

Post a Comment