Click to See Complete Forum and Search --> : Feed the object = click on the object ?! Should I believe that??
Roselene
Jan 20th, 2000, 08:12 PM
Hi, everybody!
There's something strange when I open my form! I could realize that VB is running a module that I've put in a option button click event, but I'm not clicking this button, I only open my form!
In the form activate event, I feed this button with a table field, by setting its value = true for the Optionbutton(0) or optionbutton(1), depends on the table field.
Can this be equal to a click on the button?
Is that way VB works?
How can I both keep the module which feeds the option button running on form activate event and avoid VB of running the option button on click event?
Thanks for any idea!
Roselene
netSurfer
Jan 20th, 2000, 09:07 PM
I just tested it and it does act like a click. In your case, I'd set a public variable in the declarations portion of your form.
public booClicked as boolean
then just before you feed the button from the table, set booClicked to false and then just before you leave that code, set it to true.
Then in the option buttons click event, put the code you have inside an if statement:
if booClicked = true then
end if
This should stop your problem.
Roselene
Jan 20th, 2000, 10:52 PM
Net Surfer,
Thanks, again !!!!
You really makes me happy with your useful answers!
:-)
Roselene
Roselene
Jan 21st, 2000, 12:46 AM
Martin,
Thanks very much for your attention!
When you say " add a Property on Form2 named, for example, Label1Caption", is it the same them add a variable?
I'm really learning a lot from all of you.
Regards,
Roselene
MartinLiss
Jan 21st, 2000, 02:36 AM
I'm not completely sure what you are asking, but try this.
- Bring up the code for a form
- Go to Tools>Add Procedure (this is for VB6, other VBs may be different)
- Type in Label1Caption and select the "Property" Type
- Then modify the Let and Get methods that are created for you to look like thisOption Explicit
Private g_MyCaption As String
Public Property Get Label1Caption() As String
Label1Caption = g_MyCaption
End Property
Public Property Let Label1Caption(ByVal sCaption As String)
g_MyCaption = sCaption
End Property
- You'll also need to add the variable g_MyCaption.
If you have more questions about properties, email me.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
MartinLiss
Jan 21st, 2000, 11:15 AM
Another thing you should know is that anytime you change some visible property of a control, the form that contains that control will be loaded. For example if in Form1 you say Form2.Label1.Caption = "Hi", Form2's Load event will be triggered along with any code that stems from the Load event. A good technique to prevent this from happening is to add a Property on Form2 named, for example, Label1Caption. Then in Form1 you would say Form2.Label1Caption = "Hi" (which will not load Form2). Then in Form2's Load event you would add Label1.Caption = Label1Caption, and whenever you want to load Form2, you can.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.