473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

vb 2005 and simple way to wright listview and all its propities to file

Hi not sure were to post this but would appreciate if someone knows
simple answer...... which usually never exists

hi have added all my items subitmes and colors etc to my listview1 in
vb 2005
is there a simple way to save the whole object to file
instead of iterating though each property
such as
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
FileSystem.FileOpen(1, "j:\test\lvobj.txt", OpenMode.Output,
OpenAccess.Write, OpenShare.Shared)

Write(1, obj.ToString)

FileClose(1)

End Sub
then read it in at program start

dim the file as a listview1
and it would have all my items and subitems and colors, you know
something simple

PS isn't there something magical like saveobj(.....................)
I know i'm dreaming

thanks in advance
Mar 4 '08 #1
2 1315
On Mar 4, 10:19 am, John <J...@John.comwrote:
Hi not sure were to post this but would appreciate if someone knows
simple answer...... which usually never exists

hi have added all my items subitmes and colors etc to my listview1 in
vb 2005

is there a simple way to save the whole object to file
instead of iterating though each property

such as

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

FileSystem.FileOpen(1, "j:\test\lvobj.txt", OpenMode.Output,
OpenAccess.Write, OpenShare.Shared)

Write(1, obj.ToString)

FileClose(1)

End Sub

then read it in at program start

dim the file as a listview1
and it would have all my items and subitems and colors, you know
something simple

PS isn't there something magical like saveobj(.....................)
I know i'm dreaming

thanks in advance
I'm not sure if the listview is serializable or not, but if it is you
can just serialize it to xml or a few different formats. You should be
able to find some serialization examples on google or in the ng
archives, just try to adapt those to the listview. If the listview
cannot be serialized, than you might be able to just save the
datasource to a file and restore the listview from there. Datasets and
datatables expose a SaveXml() and LoadXml() method that you can use
for this.

Thanks,

Seth Rowe [MVP]
Mar 4 '08 #2
On Mar 4, 5:19*pm, John <J...@John.comwrote:
Hi not sure were to post this but would appreciate if someone knows
simple answer...... which usually never exists

hi have added all my items subitmes and colors etc to my listview1 in
vb 2005

is there a simple way to save the whole object to file
instead of iterating though each property

such as

* Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

* * * * FileSystem.FileOpen(1, "j:\test\lvobj.txt", OpenMode.Output,
OpenAccess.Write, OpenShare.Shared)

*Write(1, obj.ToString)

* * * * FileClose(1)

* * End Sub

then * *read it *in at program start

dim *the file *as a *listview1
*and it would have all my items and subitems and colors, you know
something simple

PS isn't there something magical *like saveobj(.....................)
I know i'm dreaming

thanks in advance
Hi,
I'm not familiar with listview at the moment, but here is a code that
saves all the items of a "listbox" into a text file:

Dim myArray(Me.ListBox1.Items.Count - 1) As Object
Me.ListBox1.Items.CopyTo(myArray, 0)
Dim Data As String = Join(myArray, Environment.NewLine)
My.Computer.FileSystem.WriteAllText("c:\test.txt", Data, False)

Sorry, it's not listview control, but it might give you idea to
manipulate the same thing for listview control.
Mar 4 '08 #3

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

Similar topics

3
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data,...
2
by: MikeY | last post by:
Hi all, I am coding window forms in C#. My problem is this: I have created a "Check ListView" or a 'ListView' with checkbox's. I have populated the it with my files from my folders, mps, txt,...
13
by: David L Wright II | last post by:
Does anyone know when building a msi file under VB.Net 2003, it would try to install something from the VS 2005 Beta 1? I have both products installed. Thanks,
1
by: SQLJunkie | last post by:
Hi, I have installed SQL 2005 RTM on a new server and I keep getting this error (described below) quite frequently. Was wondering if anyone has a clue on what's happening here. I tried googling...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
5
by: vb newbie | last post by:
I found some sample VB code which I'm trying to implement in Visual Studio 2005. I think the code was VB6. VS05 doesn't like the syntax. I've distilled things down to the part with the error: ...
0
by: Rita | last post by:
Hi Everyone, I try to migrate a VB6 app to VB 2005. I have a problem with the migration of the Ax.Listview. I want to use the VB 2005 Listview insteed. I load a text file in the listview LV....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.