| | |
How to remove parts of a string
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Here is one way to do it. It assumes that the structure of the string remains the same all the time.
VB.NET Syntax (Toggle Plain Text)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim StartPoint As Integer = TextBox1.Text.IndexOf("str=") If StartPoint >= 0 Then StartPoint += 5 Dim EndPoint = TextBox1.Text.IndexOf("/>", StartPoint) If EndPoint > StartPoint Then TextBox2.Text = TextBox1.Text.Substring(StartPoint, EndPoint - 1 - StartPoint) End If End If End Sub
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Another way. If your text is in a textbox then click between the "" marks and then press a button. as:
VB.NET Syntax (Toggle Plain Text)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim StartPoint As Integer = TextBox1.Text.LastIndexOf(Chr(34), TextBox1.SelectionStart) + 1 Dim EndPoint As Integer = TextBox1.Text.IndexOf(Chr(34), TextBox1.SelectionStart) TextBox2.Text = TextBox1.Text.Substring(StartPoint, EndPoint - StartPoint) End Sub
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
![]() |
Similar Threads
- text file strings help (Visual Basic 4 / 5 / 6)
- Working with palindromes (Java)
- Hidden characters (linebreaks) in string? (ASP.NET)
- homework help with fstream (C++)
- tokenization of file input (Java)
- encrypt and decrypt query string (VB.NET)
- breaking up a String... (a bit more advance) (Java)
- Strtok() (C)
Other Threads in the VB.NET Forum
- Previous Thread: Having problem in the choice in using Query String OR session/cookies
- Next Thread: store the textbox value using loop?
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2008 access add arithmetic array assignment basic binary bing box button buttons center click code combobox component connectionstring convert cpu data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees excel exists file-dialog firewall folder google hardcopy image images isnumericfuntioncall login math memory mobile module ms msaccess mssqlbackend mysql navigate net networking opacity output pan peertopeervideostreaming picturebox picturebox1 port print printpreview problemwithinstallation project record reports" reuse save savedialog serial sqldatbase storedprocedure string temp text textbox timer toolbox updown useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vbnet view vista visual visualbasic visualbasic.net visualstudio web wpf xml






