|
|
Title | Save and restore a popup menu's selected choice when a program starts and stops |
Description | This 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. |
Keywords | SaveSetting, GetSetting, popup, Registry |
Categories | Controls, 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
|
|
|
|
|
|