Hi guys... I am really stuck... How do I perform a selection process using the if statement to carry out a certain process only if one of the selection options in a frame are true.... Please help I have now spent 4 hours on this without any luck.....
vb6 frames
Collapse
X
-
Hi don't know what the name of your option group is so we will work with option1, option2 etc.
Code:If Option1 Then 'blah blah blah ElseIf Option2 Then 'blah blah blah ElseIf Option2 Then 'blah blah blah End If
-
By the way. Another way of using these values in code is like this:
Code:txtBox1.Visible = Option1 txtBox2.Visible = Option2 txtBox2.Visible = Option3
Comment
-
Originally posted by gttbyHi guys... I am really stuck... How do I perform a selection process using the if statement to carry out a certain process only if one of the selection options in a frame are true.... Please help I have now spent 4 hours on this without any luck.....
You need to interrogate the individual controls. For example, if you have a bunch of option buttons in the frame, then you need to do something like looping through the option buttons (which are hopefully in an array) and see which one has Value = True.
It might make more sense to set a form-level (or global) variable each time one of the option buttons is selected, then just check that value when you want to know the result.
Oh rats! Willakawill beat me to it again. :)Comment
-
Originally posted by willakawillHi don't know what the name of your option group is so we will work with option1, option2 etc.
Code:If Option1 Then 'blah blah blah ElseIf Option2 Then 'blah blah blah ElseIf Option2 Then 'blah blah blah End If
Comment
-
Originally posted by Killer42You may be confusing it with VBA, where the frame itself returns a value based on the selection within it. I'm almost certain VB6 doesn't do that.
You need to interrogate the individual controls. For example, if you have a bunch of option buttons in the frame, then you need to do something like looping through the option buttons (which are hopefully in an array) and see which one has Value = True.
It might make more sense to set a form-level (or global) variable each time one of the option buttons is selected, then just check that value when you want to know the result.
Oh rats! Willakawill beat me to it again. :)Comment
-
Originally posted by gttbyMany thanks but where do i Place this code is it on frame click or what I am a bit confused...
If it is supposed to happen as soon as the user clicks, then it would go in the appropriate event of the option button (array, I hope). Probably the Click event.Comment
-
Originally posted by Killer42You do this code at the point where you want to know which option is currently selected.
If it is supposed to happen as soon as the user clicks, then it would go in the appropriate event of the option button (array, I hope). Probably the Click event.Comment
-
Originally posted by gttbyMany thanks but where do i Place this code is it on frame click or what I am a bit confused...Comment
-
Originally posted by willakawillYup, just as Killer says, you don't get run by your code, you run your code the way that you want it. Look at the values exactly when it works for you to do so.Comment
Comment