How to save ListView settings?

greenguy

Registered User.
Local time
Today, 03:22
Joined
Oct 30, 2007
Messages
36
Hello all I have been trying to find information on how I can save the changes made to a List View control after the user reaarranges the column headings to his/her liking. Below was my first unsuccessful attempt and was wondering if someone could help by pointing me in the right direction? The code isn't finished (doesn't work anyway) but I was trying to get it out of my head as to what I want to do. I will keep looking but if someone has some great ideas I'm game to learn!!

Thanks
:D
 
You would need to have a table for storing the preferences and load them when the form loads.
 
Hey Bob thanks for the reply!
I can create a table to store the user's preferences but I'm not sure what values I'm poplulating them with when it comes to the List View control. My thought was to have a check box or command bar saying "save user's settings". Then, after the user rearranges the columns he/she can select this option. I'm probably missing the boat here and apologize for the ignorance. Maybe I'm not using the right terminology here but I can't seem to find any FAQs on this.
 
Well, for one thing - list boxes aren't able to let the user drag the columns around, so you have to provide a way for them to do so. I've done something similar with sorting but not the columns. However, what you would need to do is to change the rowsource of the list box based on their selections, save that SQL string in their preferences and then set the listbox rowsource when the form loads (remembering to use the Me.ListBoxName.Requery to fill the listbox with data).

Hopefully that helps.
 
Hey Bob, thanks again for the reply. If I were using a list box then your answer would apply but I'm not using a list box I'm using a List View which is an Active X Control. This control allows the columns to be rearranged so it's more flexible than the standard list box control.

Thanks again
 
Ah, sorry I missed that. The first thing would be to determine what the current column display order is and then store it. I'm sure that there's probably a way to do that using the index of the column and then the name to match it up. So, I guess the question is, what part do you need help with? I think it's pretty self-explanatory but that's my thought and yours could be not even close to mine.
 
No need for apologies Bob it's all good. The problem (what I need help with) is I can loop through the control and find the index of each column; not a problem. The problem is, after the columns get rearranged the index of the columns remain the same. It's almost like it's read only. In other words if "Name" is in Column (Index) 1 and "City" were in column (Index) 2 after rearranging them the index of "Name" is still 1 and "City" is still 2. Maybe there is absolutely no way of doing this but me being a rookie I wasn't sure.

Thanks again for replying!!
 
No need for apologies Bob it's all good. The problem (what I need help with) is I can loop through the control and find the index of each column; not a problem. The problem is, after the columns get rearranged the index of the columns remain the same. It's almost like it's read only. In other words if "Name" is in Column (Index) 1 and "City" were in column (Index) 2 after rearranging them the index of "Name" is still 1 and "City" is still 2. Maybe there is absolutely no way of doing this but me being a rookie I wasn't sure.

Thanks again for replying!!

I'll try and play with this over the weekend.
 
Also, would it be possible to get your db so I don't have to try to recreate the listview stuff and can concentrate on your problem? If too big for here I can PM you an email address to send it to.
 
Sorry about taking so long Bob, I didn't get the email notification. I'll work on sending you a .zip file with one of my listviews. Thanks again.

:D
 

Attachments

Users who are viewing this thread

Back
Top Bottom