There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer blue screen blue screen of death boot computer connection crash css dell display driver drivers email error ethernet excel firefox firefox 3 hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express partition printer problem problems ram router security slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
vb - storing contents of a list box


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
lonesome_wolf2000's Avatar
Senior Member with 410 posts.
 
Join Date: Dec 2000
08-Jul-2002, 07:02 PM #1
vb - storing contents of a list box
I was wondering what would be the best way to store the contents of a list box, so that I can reopen it at runtime and have the data imported back into the list box?
lonesome_wolf2000's Avatar
Senior Member with 410 posts.
 
Join Date: Dec 2000
08-Jul-2002, 07:04 PM #2
what im trying to do is to make a program that is like a shortcut for other programs.

you point the program to the directory for an exe file, then, stores a brief description of the program in the list. Then click on the item in the list then click on "run selected program"

i want it to be able to restore a list of the programs that have already been entered.

should I do this through registry? or through files? need help on how to with both


thanks
TimCottee's Avatar
Senior Member with 186 posts.
 
Join Date: Oct 2001
Location: Southampton, England
09-Jul-2002, 04:34 AM #3
The choice is yours really, one advantage of using the registry is that by default this is customised to each individual user on the computer as the default registry methods in VB use the HKEY_CURRENT_USER hive of the registry. Using file methods you would have to handle this yourself. Personally I would go with the registry.

Code:
Private Sub cmdSaveList_Click()
  Dim intItem As Integer
  For intItem = 0 To List1.ListCount - 1
    SaveSetting App.Title,"Program List","Program " & CStr(intItem + 1),List1.List(intItem)
  Next
End Sub

Private Sub cmdRetrieveList_Click()
  Dim intItem As Integer
  List1.Clear
  For intItem = 1 To 10 
    List1.AddItem GetSetting(App.Title,"Program List","Program " & CStr(intItem),"No Program Stored")
  Next
End Sub
Obviously this is a basic example and doesn't allow for much flexibility or handling of invalid entries etc. The biggest issue with using this method is that the number of programs is defined as 10 to retrieve regardless of how many are stored. There is a solution to this (there almost always is) and that is to use the GetAllSettings function.
__________________
TimCottee
I know a little about a lot of things and a lot about very little.

Brainbench MVP For Visual Basic
http://www.brainbench.com

MCP, MCSD, MCDBA, CPIM

Visit http://flame2006.org.uk or http://www.timcotte.tk
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:38 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.