|
-
Sep 21st, 2000, 09:38 AM
#1
Thread Starter
Junior Member
Ok, sorry about to lower the standards guys, but i have to post this question:
I have a form on which i have two combo boxes pre-loaded with 1 - 24 indicating hours, and 0, 5, 10.... up to 55 to indicate minutes. I have used the .additem method in the form's load event to do this.
What i want to do is allow the user to select the required hours and minutes to be used in a timer event. I don't have any problems with the conversion stuff.
My problems are in fact, twofold. The first is this:
I am trying to identify when the user changes a value. Being used to Access, i looked for an afterupdate event, but no such luck... :-( I have found the change event, and can't understand why this doesn't work:
Private Sub cboHours_Change()
lblHours = cboHours.Text
lblHours.Refresh
End Sub
Why don't i see the selected value in lblHours????
My second problem, is how do i store the selected values so that when the program is re-opened, the vlues are still there? I'd like to see them displayed, but still offer the values i listed at the beginning of my posting.
Thank guys.
-
Sep 21st, 2000, 10:38 AM
#2
1. You shoud use Combo's Click event instead:
Code:
Private Sub cboHours_Click()
lblHours.Caption = cboHours.List(cboHours.ListIndex)
End Sub
2. You can save your selection in the registry and then use the value from there:
Code:
Private Sub Form_Load()
'Your loading process for cboHours and cboMinutes goes here
'Get posiotion of an item for each combobox from the registry
cboHours.ListIndex = GetSetting("MyProgram", "ProgramSettings", "cboHours", 0)
cboMinues.ListIndex = GetSetting("MyProgram", "ProgramSettings", "cboMinutes", 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Save position of an item in each combobox
SaveSetting "MyProgram", "ProgramSettings", "cboHours", cboHours.ListIndex
SaveSetting "MyProgram", "ProgramSettings", "cboMinutes", cboMinutes.ListIndex
End Sub
Regards,
-
Sep 22nd, 2000, 02:26 AM
#3
Thread Starter
Junior Member
Thanks Serge!!!!
A couple of questions....... Can you clarify for me when i should use the change as opposed to the click event, and will the registry settings work as i develop the program in VB Professional, or do i have to "install" it? I presume the "Program Name" string is the name of my project.
-
Sep 22nd, 2000, 03:17 AM
#4
The change event is like the change event of the textbox - it only fires when the user edits the text in the combo. Therefore, it doesn't work when the style is 2 - Dropdown List, cos the user can't edit the contents of the combo.
- gaffa
-
Sep 22nd, 2000, 03:19 AM
#5
Oh, and the registry settings will work as soon as you run the program in the development environment.
- gaffa
-
Sep 22nd, 2000, 10:29 AM
#6
Yes, that's correct. All registry entries willbe created when you close your form (do not press end button in VB IDE).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|