| | |
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 .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port position print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml year






