Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

ListView Columns

Can a listView be loaded with the same column sizes as made by the user by dragging the columns in the privious application load?

Suppose the user loaded an application having ListView. The column was not appropriate in size to fit the contents. So he extended the columns using mouse arrow. He closed the application. And again when the user opens the application, it must have the same length of columns as was made by dragging the column.

How to do that?
[475 byte] By [naikosen] at [2007-11-11 10:26:38]
# 1 Re: ListView Columns
one solution is to save the information in the registry in your form unload, and retrieve it when the listView has been initialized.
Use SaveSetting and GetSetting

I usually save the column widths in a string separated by a known character, like this

123|123|456|564

when I read the string I use Split to put the single elements in an array

Marco
mstraf at 2007-11-11 17:22:39 >
# 2 Re: ListView Columns
Excuse me 'Mstraf'. Would you please guide me kindly how to save the setting in registry?
Thank you very much for your attention.
naikosen at 2007-11-11 17:23:39 >
# 3 Re: ListView Columns
Hi naikosen,
I'm not an expert programmer but I have used the save setting to registry before,

you need to type savesetting app.title,section,Key,Setting
an example of one that I use is : savesetting app.title,"Startup","UserLoad",txt_Path.text

this would then save the settings to the registry files, to retrive the setting I the use
Bah = Getsettings(app.title,"Startup","UserLoad")

this would the put your settings from the registry into your bah.

I hope this helps, like I said at the start I'm no expert

Chris
Chris Yard at 2007-11-11 17:24:40 >
# 4 Re: ListView Columns
Thank you all very much
naikosen at 2007-11-11 17:25:45 >