|
-
Jul 25th, 2001, 04:28 PM
#1
Thread Starter
New Member
option button
Hello,
In the click-event of the option buttons i have some code that add the caption of the option button in a listbox when value is true.
When a user changes this value while using the program i use a piece of code that puts all of the option buttons in the program to default when running a new session of the program.
And this give the problem. Every time i use the "set to default" code it puts the caption of the option button to the listbox.
And this is not what i want...
HELP....
Greetings,
Progger
-
Jul 25th, 2001, 04:44 PM
#2
Fanatic Member
An easy way to do this would be something along these lines
in the Option buttons click event.
VB Code:
'In General Declarations section of the Form
Public isDefault As Boolean
Private Sub Option1_Click()
If Option1.Value = True then
If isDefault = False Then
List1.Additem Option1.Caption
Else
isDefault = False
End If
End If
End Sub
Just set the isDefault value to false when for all events except when you run your makedefault code set the isDefault value to true in there
-
Jul 25th, 2001, 06:43 PM
#3
PowerPoster
Hi
A generic way to accomplish this in the minimum of code and so that ur program maintenance doesnt become a nightmare is to set a flag before combos, checkboxes, option boxes etc are loaded and then reset the flag after all items are loaded.
pseudo code
Dim fbooDoStuff as boolean 'I dont really name vars this way!!
fbooDoStuff = False 'defaults to false anyhow
'Code to set your option boxes to default settings
fbooDoStuff = True
In any of ur option box, combo box etc Click events (or whichever one fires dep on the control) just test the do stuff variable
If fbooDoStuff then
'Process as if the user selected
End If
Regards
Stuart
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
|