Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 7th, 2009, 08:20 AM
Registered User
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listview help & split froma string method help

Hello, I have tryed on a few other forums but just keep getting sent in circles so hopefully i will get it sorted here.

Right. problem one. I have a listview (lvpost) that has two colums, username & ID

Every time a user is added it saves this to a textfile which will look like this

Code:
user1:id
user2:id
user3:id
and so on. The problem is is now reloading this information into lvpost when the form is loaded. all i know is.

Code:
            'Load user agent
            Dim sTemp As String
            sTemp = My.Computer.FileSystem.ReadAllText("C:\Uis\Agent.txt")
Which puts all the data into a string.

Problem 2

Now i have no idea what so ever how to split each line, user1 (split the : that seprates the two values) ID then add user to username in the list view and then add ID to the subindex of the listview.

then obviously loop threw all the entrys in the text file.

I have tryed looking for 3 days but cant solve this.


This is my last resort here :(
 
Old May 7th, 2009, 08:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

String.split is one of the things you are looking for. Also you want to read about string.substring().

That's all what you need, but you can always open the file as a StreamReader, and read one line at a time, forget about the split and only use substring to get the data before and after the :...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to split string krevathi1912 Access VBA 10 September 6th, 2007 02:21 AM
split method.... seymour_glass C# 6 May 3rd, 2007 07:37 AM
How to split this string chanduboorla XSLT 1 April 13th, 2006 04:15 AM
string split vidhya XSLT 1 August 10th, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.