473,769 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing
FileSystem.File Open(1, "j:\test\lvobj. txt", OpenMode.Output ,
OpenAccess.Writ e, OpenShare.Share d)

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 1329
On Mar 4, 10:19 am, John <J...@John.comw rote:
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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

FileSystem.File Open(1, "j:\test\lvobj. txt", OpenMode.Output ,
OpenAccess.Writ e, OpenShare.Share d)

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.comw rote:
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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

* * * * FileSystem.File Open(1, "j:\test\lvobj. txt", OpenMode.Output ,
OpenAccess.Writ e, OpenShare.Share d)

*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.List Box1.Items.Coun t - 1) As Object
Me.ListBox1.Ite ms.CopyTo(myArr ay, 0)
Dim Data As String = Join(myArray, Environment.New Line)
My.Computer.Fil eSystem.WriteAl lText("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
9316
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, checkbox's and icons are displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s), where I am able to select (Check-mark) various checkboxs items and able to alter the data. I do...
2
2965
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, etc. The ListView is in Details, with headers and an Icon. What I am trying to accomplish is to rename/append check mark file massively (at once). This is accomplished by the user inputting a name into a provided
13
1311
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
3392
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 but no success! This generally happens when I am browsing the tree in Object explorer in SQL 2005 Management Studio. I can be doing anything - like viewing databases, or viewing table list or viewing stored procedure list, etc.
3
10598
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
5
2022
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: Public Sub WontRun(ByVal v As ListView) Dim x As ListItem x = v.ListItems.Add(, , "c:\test\file.txt") End Sub
0
953
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. Here is a sample text file: "1234567" 3 "Bart"
0
10212
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...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
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
9863
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
8872
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...
0
6674
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
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.