Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving listbox items using GetSetting? 2

Status
Not open for further replies.

r3b00t

Technical User
Aug 13, 2002
45
0
0
GB
Ive got a project where the user is asked for three responses, these responses, when the appropriate button is clicked, are added to a listbox on a second form and the user can view the items by pressing a button to display the second form.

The problem i have is, when the program is closed and re-opened the items that were in the listbox are now gone.

Ive been messing about with some code using the SaveSetting and GetSetting functions but havent been able to get it right yet.

Heres what ive got so far

Private Sub Form_Unload(Cancel As Integer)
SaveSetting App.EXEName, "Settings", "LIST", list1.ListIndex
End Sub

and on the second form

Private Sub Form_Load()
For X = 0 To list1.ListCount - 1
list1.AddItem (X)
Next
On Error GoTo aaron:
list1.ListIndex = GetSetting(App.EXEName, "Settings", "LIST")
aaron:
End Sub

Can any of you guys please help?!?

Cheers

r3b00t

 
Yeah im using alphanytz's code because your code keeps producing the error message subscript out of range on this line List1.AddItem aryList(lngCount).

How could i remove the space in alphanytz's code?

Also how would i go about placing a small jpeg in the title bar of the app???

Thanx

r3b00t
 
Instead of
Code:
For lngCount = 0 To lngUpper   'Revised
try
Code:
For lngCount = 0 To lngUpper - 1  'Revised twice

Suggest you start your other question in a new thread Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Also thanks for stars - much appreciated! Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
If you're referring to the standard icon in the upper left window of your form, you can only place icon files there (*.ico) and you specify these through the VB Interface (a project setting or form window setting I think) Greg W
wolgemga@aecl.ca
 
Thanx again johnwm, much appreciated!!!

Regards

r3b00t
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top