|
-
Jul 27th, 2007, 03:41 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [02/03] Manipulate a form from a different class
Hello,
I have three classes, Common, A, and B. A and B reference Common so that they have access to variables inside it (I know this may be bad design, but I didn't do it, and I can't change it). From A, I can make a new B.Main form. No problem. However, we only want one copy of B.Main open at a time. So, we store a variable in Common called (basically) BMainOpen (boolean). In A, if they try to open a new instance of form B, and one is already open, I would like to give them the ability to jump to the point they wish, not just close it and open a new one. However, I need to know the...?... handle?... memory address?... of the open B.Main form, so I can manipulate it (load the correct data, set the selectedTabPage of the tab control, etc.). I thought I would just add another variable of type B.Main to Common, but I can't reference B from Common because B already references Common, which would cause circular dependency (the VB IDE won't let me).
In Form A
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f as B.Main
If Not BMainOpen Then
f = new B.Main
Else
f.? = MyStoredVariable
End If
f.DoStuff()
f.Show()
End Sub
I just need to know what f.? and MyStoredVariable would be.
Confused? I tried to make it as simple as I could. Anyone know the solution?
Thanks
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
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
|