Saving Combo box entries in the registry 
Author Message
 Saving Combo box entries in the registry

If I do a:

SaveSetting "Take a Hike Software", "Mr. Internet", "Combo1",
Combo1.Text

This only saves the selected item, how would I Save all of the items and
the retrive them with getsetting?

Thanks in advance.

Remove NOSPAM prior to responding to me by e-mail.
-- Ryan Martinsen

-- http://www.*-*-*.com/

Keep it small.  Keep it simple.



Fri, 28 Jul 2000 03:00:00 GMT  
 Saving Combo box entries in the registry

Ryan,

How about this code:

Dim CurrentItem As Integer
Dim sWork As String
Dim iWork As Integer
'
' Save the elements of the combo box as item1;item2;item3....
' If any of the elements can contain a semi-colon, use some other character
to seperate each element.
'
For CurrentItem = 0 To Combo1.ListCount - 1
    If CurrentItem > 0 Then
        sWork = sWork & ";" & Combo1.List(CurrentItem)
    Else
        sWork = sWork & Combo1.List(CurrentItem)
    End If
Next
MsgBox sWork
'
' Now you can save sWork with SaveSettings.
'
' To load the combo box from the SaveSettings value:
'
Combo1.Clear
Do
    iWork = InStr(sWork, ";")
    If iWork > 0 Then
        Combo1.AddItem Left$(sWork, iWork - 1)
        sWork = Mid$(sWork, iWork + 1)
    Else
        Combo1.AddItem sWork
    End If
Loop Until iWork = 0

Helmar B. Herman

Quote:

>If I do a:

>SaveSetting "Take a Hike Software", "Mr. Internet", "Combo1",
>Combo1.Text

>This only saves the selected item, how would I Save all of the items and
>the retrive them with getsetting?

>Thanks in advance.

>Remove NOSPAM prior to responding to me by e-mail.
>-- Ryan Martinsen

>-- http://members.xoom.com/srm/

>Keep it small.  Keep it simple.



Fri, 28 Jul 2000 03:00:00 GMT  
 Saving Combo box entries in the registry

Quote:
> How about this code:

Thanks!  Worked great!

Remove NOSPAM from e-mail.
-- Ryan Martinsen

-- http://members.xoom.com/srm/

"My software never has bugs.  It just develops random features."



Sun, 30 Jul 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Copy Last entry on Combo Box to Text Box

2. Help saving registry entries

3. Save Text Boxes Values To Combo Box's Item

4. Combo Box That Adds Typed Entry to List

5. Combo Box listing Autotext Entries from Add-In Template

6. Listing Autotext Entries in UserForm Combo Box

7. allowing a blank entry in a combo box

8. Smart (incremental) Combo Box data entry

9. Combo Box - Going to a specific entry in the list

10. How add entries in an ActiveX combo box ?

11. VBScript Newbie : Form Entry using a combo box without submit button

12. Highlighting data in the text portion of a combo box and overwriting it upon data entry

 

 
Powered by phpBB® Forum Software