hi my frined. I have a program. There is a listview box and in that lsit view there are some info like;
ID | date | hour
----------------------------------------------------
30158 | 20.07.2010 | 20:52:18
30196 | 21.07.2010 | 12:17:17
.
.
.
.
.
.
goes like this.
I want to write all this this data to a txt file like this
1st line = "30158","20072010","205218"
2nd line = "30196","21072010","121717"
but in the txt file there wont write 1st line 2line ect.. But " will remain. How can I do this?
writing listview items to a txt filevisual basic 2008
Page 1 of 1
4 Replies - 4066 Views - Last Post: 25 July 2010 - 11:57 PM
Replies To: writing listview items to a txt file
#2
Re: writing listview items to a txt file
Posted 22 July 2010 - 03:45 AM
I'd suggest creating a string array with each of your rows and coloumn's data in it, and then save that to a text file usinga streamwriter.
Otherwise, you might be able to use Environment.NewLine
Otherwise, you might be able to use Environment.NewLine
#3
Re: writing listview items to a txt file
Posted 22 July 2010 - 09:41 AM
To convert the string from the original format to the new format. Once you read in the line and store it (in this example, stored to a string named String1) you can do the following to replace and insert characters.
Then save the newly formed string back to a file
string1 = string1.Replace(" | ", """,""").Replace(".", "").Replace(":", "").Insert(0, """") & """"
Then save the newly formed string back to a file
This post has been edited by CharlieMay: 22 July 2010 - 09:42 AM
#4
Re: writing listview items to a txt file
Posted 23 July 2010 - 07:41 AM
Before you can do either of the two suggestions already made you need understand that you have to do this while loopings through the ListView's items.
(Pseudo code)
-Frinny
(Pseudo code)
For each item in the ListView,
Create a string that will contain the item's data
For each sub-item within the item
Add the value to the string
Loop...
Add an newline to the end of the string and then add the string to the text file
Loop...
-Frinny
This post has been edited by Frinavale: 23 July 2010 - 07:43 AM
#5
Re: writing listview items to a txt file
Posted 25 July 2010 - 11:57 PM
@charlieMay thank you. It works.
also thanks all of you friends, for allocating your time.
also thanks all of you friends, for allocating your time.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|