Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- From: Chris <no@xxxxxxxx>
- Date: Wed, 03 Aug 2005 15:40:23 -0400
Gerry~Lowry wrote:
| As long as myModuleCode has a reference to "Form1" then you can do this. | You'll probably have to send in a reference to form1 to form2. | Something like: | | public class form2 | dim RefToForm1 as Form1 | sub new(F1 as Form1) | mybase.new() | RefToForm1 = F1 | end sub | sub myModuleCode() | RefToForm1.Visible = False | ..... | RefToForm1.Visible = False | end sub | End class | | note that this way of doing it causes you to create Form2 this way: | | From inside Form1 somewhere... | dim F2 as new Form2(Me) 'This passes in the reference of form1 to form2 | | Hope it helps | Chris
Hi, Chris ... it may help ... although I sense potential problems in more complex programs ...
For example, Form1 opens Form2, Form2 calls the sub "chris" in Module1, "chris" hides Form1, then, later, Form1 opens Form3, Form3 calls the sub "chris" in Module1, "chris" hides Form1.
This all appears to force far to much form to form to module or class communication.
Since ALL of these code units are compiled together, it would be so much easier if one could say from ANYWHERE, in a simple syntax, something like
"Form1".Visible = <truth value>
It would have been so much easier if VB.NET had included the VB6 Forms collection.
g.
You could make Form1 a module level variable and give everyone access, but this does not really follow the OO method of development. You could make your own forms collection if you wanted, again same issue.
"This all appears to force far to much form to form to module or class communication."
How is this a problem. I also don't see how it's form to form to module communication... Form2 hides Form1, calls the module, shows Form1. You could handle this as an event I guess. Make an event in Form2 called "StartProcess" and one called "EndProcess" Then have Form1 handle the Form2 events.
in Form2:
RaiseEvent(StartProcess) callProcessFunction RaiseEvent(StopProcess)
in Form1
'This could be done dynamically use addhandler/removehander instead of using "handles" keyword
private sub StartProcess_Handler() handles form2.StartProcess
me.visible = false
end sub
Chris
.
- Follow-Ups:
- Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- From: Gerry~Lowry
- Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- References:
- Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- From: gerryLowry::Ability Business Computer Services {KCAZ0H1}
- Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- From: Chris
- Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- From: Gerry~Lowry
- Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- Prev by Date: Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- Next by Date: Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- Previous by thread: Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- Next by thread: Re: Form Reference Question (Getting Back Your Visual Basic 6.0 Goodies)
- Index(es):
Relevant Pages
|