|
-
Nov 20th, 2010, 08:38 AM
#1
Thread Starter
Addicted Member
[RESOLVED] How to get x number of characters after a string?
Say I open a text file in a richtextbox control. After that I search for a specific string like "6.1". The string actually continues like "6.1XXXXXXX". I need to get not just only "6.1", but also 2 more chars after "6.1", like "6.1XX". i will then output this in a textbox, but i can do that, I don't know how to get the X number of characters, any help or idea with that?
-
Nov 20th, 2010, 09:33 AM
#2
Re: How to get x number of characters after a string?
try this:
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim findString As String = "6.1"
TextBox1.Text = RichTextBox1.Text.Substring(RichTextBox1.Text.IndexOf(findString), findString.Length + 2)
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 20th, 2010, 09:45 AM
#3
Thread Starter
Addicted Member
Re: How to get x number of characters after a string?
 Originally Posted by .paul.
try this:
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim findString As String = "6.1"
TextBox1.Text = RichTextBox1.Text.Substring(RichTextBox1.Text.IndexOf(findString), findString.Length + 2)
End Sub
THANK YOU sooooo much, you have helped me a lot with this one, you can call this thread resolved now! Once again, thanks!
-
Nov 20th, 2010, 09:47 AM
#4
Re: How to get x number of characters after a string?
 Originally Posted by Legjendat
you can call this thread resolved now!
Or you can, using the Thread Tools menu.
-
Nov 20th, 2010, 09:52 AM
#5
Thread Starter
Addicted Member
Re: How to get x number of characters after a string?
 Originally Posted by jmcilhinney
Or you can, using the Thread Tools menu. 
My bad, sorry, never had a thread resolved till now, this was the first one so I didn't know I could call it resolved myself, done now!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|