473,770 Members | 6,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A listview is moving on...

Hi!

This saves data from column1 in a Listview to disk like: 2005-09-20.txt

I've come so far in my research:

Dim fs As New FileStream("C:\ " &
MyCalendar.Toda yDate.ToShortDa teString() & ".txt",
FileMode.OpenOr Create)

Dim sw As New StreamWriter(fs )
fs.Flush()
sw.Flush()
Dim r1 As Integer
For r1 = 0 To lstMyList.Items .Count - 1

sw.WriteLine(ls tMyList.Items.I tem(r1).Text)

Next

sw.Close()
fs.Close()

However, how am I about to cycle through the second column and write it
to the same textfile?

The listview has two columns. Column1 will hold time like:

07:00
07:30....etc

Column2 will hold text, so it will look like:

07:00 Remember to eat something
07:30 Get dressed

Hope anybody can give me a better understanding on this subject.

Me.Name

Nov 21 '05 #1
2 1163
Hi, this should help, in a listview with multicolumns the values are saved
as subitems of the mainitems you can access them like this:

For i As Integer = 0 To ListView1.Items .Count - 1
objWrite.WriteL ine(ListView1.I tems(i).SubItem s(0).Text & " " &
ListView1.Items (i).SubItems(1) .Text)
Next

hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

<gs***@hotmail. com> schreef in bericht
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Hi!

This saves data from column1 in a Listview to disk like: 2005-09-20.txt

I've come so far in my research:

Dim fs As New FileStream("C:\ " &
MyCalendar.Toda yDate.ToShortDa teString() & ".txt",
FileMode.OpenOr Create)

Dim sw As New StreamWriter(fs )
fs.Flush()
sw.Flush()
Dim r1 As Integer
For r1 = 0 To lstMyList.Items .Count - 1

sw.WriteLine(ls tMyList.Items.I tem(r1).Text)

Next

sw.Close()
fs.Close()

However, how am I about to cycle through the second column and write it
to the same textfile?

The listview has two columns. Column1 will hold time like:

07:00
07:30....etc

Column2 will hold text, so it will look like:

07:00 Remember to eat something
07:30 Get dressed

Hope anybody can give me a better understanding on this subject.

Me.Name

Nov 21 '05 #2
Does it have to be text? If not, then serialize the complete control
using the BinaryFormatter to file.

gs***@hotmail.c om wrote:
Hi!

This saves data from column1 in a Listview to disk like: 2005-09-20.txt

I've come so far in my research:

Dim fs As New FileStream("C:\ " &
MyCalendar.Toda yDate.ToShortDa teString() & ".txt",
FileMode.OpenOr Create)

Dim sw As New StreamWriter(fs )
fs.Flush()
sw.Flush()
Dim r1 As Integer
For r1 = 0 To lstMyList.Items .Count - 1

sw.WriteLine(ls tMyList.Items.I tem(r1).Text)

Next

sw.Close()
fs.Close()

However, how am I about to cycle through the second column and write it
to the same textfile?

The listview has two columns. Column1 will hold time like:

07:00
07:30....etc

Column2 will hold text, so it will look like:

07:00 Remember to eat something
07:30 Get dressed

Hope anybody can give me a better understanding on this subject.

Me.Name

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3420
by: Nick | last post by:
Hi there, I'm trying to implement drag-drop for my listview control in large icon view mode. Unfortunately the order of the items gets completely messed up upon inserting the item back into the listview, removing the item obviously keeps everything fine but the second I use insert the item is added to the *end* of the listview. Does anyone have any tips on how I can solve this issue?? Call Items.Remove(SourceItem)
6
4802
by: Dave | last post by:
VB6 has a SorkKey property that you can setup on the ListView control to tell the ListView what column to use for sorting. In .NET there is a Sort() method and a SortOrder property that you can use to manipulate the Sorting property. My question is how do I perform the same functionality as I do in VB6 setting the SortKey and SortOrder with the ListView. Dave
6
7312
by: Dave | last post by:
VB6 has a SorkKey property that you can setup on the ListView control to tell the ListView what column to use for sorting. In .NET there is a Sort() method and a SortOrder property that you can use to manipulate the Sorting property. My question is how do I perform the same functionality as I do in VB6 setting the SortKey and SortOrder with the ListView. Dave
5
2374
by: Martin Horn | last post by:
Hi all, I want to implement a listview with editable subitems and I assume the easiest way is to overlay a textbox over the item to be edited. With this in mind I have come up with: Using fullrowselect=true in the listview Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, _
1
3019
by: shapper | last post by:
Hello, I have a ListView where I use LINQ for data, for example, selecting, and deleting. In the ListView item template I added a DataPager. When I click, for example, "Next Page" or a page number in the DataPager something strange happens: It always takes me 2 clicks for the action to be taken.
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.