I am using visual studio 2010 (vb.net- windows form ).
I have a text box which consist of number's date and string.
i need to highlight all numeric values and date in that text box and need an option to change the value on mouse click . (ie No changes in string content)
for example
let value in text box be
"Hi my name is Sidharth. I'm 26 yr old . my dob is 22/03/1990"
when value is loaded to text box
it should display as
"Hi my name is Sidharth. I'm
26 yr old . my dob is
22/03/1990"
on mouse click or mouse focus i need an option to change.
Dim TextToFormat As Integer
Dim TextFormat As String
TextFormat = 1
TextToFormat = "Hi my name is Sidharth. I'm 26 yr old . my dob is 22/03/1990"
Dim count As New List(Of Integer)()
For i As Integer = 0 To rText.Text.Length - 1
If rText.Text.IndexOf(TextToFormat, i) <> -1 Then
count.Add(rText.Text.IndexOf(TextToFormat, i))
End If
Next
Try
For i As Integer = 0 To count.Count - 1
rText.[Select](count(i), TextToFormat.Length)
Select Case TextFormat
Case 1
rText.SelectionFont = New Font(rText.Font.FontFamily, rText.Font.Size, FontStyle.Italic)
Case 2
rText.SelectionFont = New Font(rText.Font.FontFamily, rText.Font.Size, FontStyle.Italic)
End Select
count.RemoveAt(i)
Next
Catch
End Try
in this im searching a text in txtbox and formatting the text
bt i need to get all numerical values.