|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
string formattingmy result to get everything after that last "/" character. This code gets everything before. Do While objReader.Peek() <> -1 TextLine = objReader.ReadLine() TextLine = TextLine.Substring(0, TextLine.LastIndexOf("/"c)) MsgBox(TextLine) Loop Example: Applications/AS - ED Tracking Board/EDTB Train I would like it to result to this EDTB Train Instead I am getting this: Applications/AS - ED Tracking Board thanks Do While objReader.Peek() <> -1
TextLine = objReader.ReadLine() TextLine = TextLine.Substring(TextLine.LastIndexOf("/"c),TextLine.lenght ) MsgBox(TextLine) Loop that gave me an error:
Index and length must refer to a location within the string. Parameter name: length TextLine = TextLine.Substring(TextLine.LastIndexOf("/"c))
Note that LastIndexOf returns -1 if it can't find the character (thus causing the above code to throw an exception) /claes Show quoteHide quote "Brian Cahill" <bcah***@wfs-ops.org> wrote in message news:1142888469.480772.252660@z34g2000cwc.googlegroups.com... >I am attempting to populate a listbox from a text file. I would like > my result to get everything after that last "/" character. This code > gets everything before. > > Do While objReader.Peek() <> -1 > TextLine = objReader.ReadLine() > TextLine = TextLine.Substring(0, TextLine.LastIndexOf("/"c)) > MsgBox(TextLine) > Loop > > Example: > Applications/AS - ED Tracking Board/EDTB Train > > I would like it to result to this > EDTB Train > > Instead I am getting this: > Applications/AS - ED Tracking Board > > thanks >
COnverting CSV to XLS file
VB.NET Thread Garbage Collection Property and type easy one Windows Thumbnail Control Problems with Quotes in SQL queries in VB.Net Regular Expressions Problem Microsoft VBScript compilation error '800a0400' Where did this come from: Microsoft\CStoVBConverter\Samples\Smart Client\ Control modifiers |
|||||||||||||||||||||||