Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleSave and restore a popup menu's selected choice when a program starts and stops
DescriptionThis example shows how to save and restore a popup menu's selected choice when a program starts and stops in Visual Basic 6. It uses SaveSetting and GetSetting to save and restore the selected item.
KeywordsSaveSetting, GetSetting, popup, Registry
CategoriesControls, Software Engineering, Tips and Tricks, Windows
 
Thanks to Gamal Azim.

When the application starts, use GetSetting to read the saved index of the selected popup menu item. When the user selects a menu item, check it and use SaveSetting to save the selected index.

 
Private Sub Form_Load()
    f1(GetSetting(App.Title, "Settings", "SaveValue", _
        "0")).Checked = True
End Sub

Private Sub f1_Click(Index As Integer)
    Select Case Index
        Case 0:
            f1(0).Checked = True
            f1(1).Checked = False
            f1(2).Checked = False
        Case 1:
            f1(0).Checked = False
            f1(1).Checked = True
            f1(2).Checked = False
        Case 2:
            f1(0).Checked = False
            f1(1).Checked = False
            f1(2).Checked = True
    End Select

    SaveSetting App.Title, "Settings", "SaveValue", Index
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated