Re: MDI and the active doc
First of all, welcome to VB, second of all, you're going in the good direction:
1) Yes, this can be done with that
2) You should make the document window MDI Child, any tool or option windows (or others) that need to be shown as modal must be SDI.
3) You cannot address a MDI Child using Form2 or something like that (okay, you can, let me explain). You probably created an instance of the form using something like Dim frm As New Form2. This results in the form only being accessible via it's refference, which in this case is the frm object. There are however some other ways to get the refference, like using the ActiveForm property of the MDI Parent window. This will give the refference to the MDI Child window that is selected (if any).
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Re: MDI and the active doc
Thanks for the reply. Boy, that is going to make things very difficult. I guess I am just to used to using pointers and being able to gain access to whatever I need. I am really not sure what to do from here. The entire point of having the document in the first place was to have a common place for all of the applications data. If I cannot reliably get a reference to the doc then it is completely useless to me.
Can I basically put all of the document code into the MDI form, because that is referencable from any form in the project?
TIA,
Scott
C++ Software Engineer
aka: Fletch
Hillsborough, NC
Re: MDI and the active doc
You just need to make the code public. If you make a sub or function public, you will be able to access the code form everywhere. Also, you can declare the refference (pointer) to the form as public, which allows you to access the form from everywhere.
' Somewhere in a module
public frmDoc as frmMainDocument
'
' somewhere else where the program starts, or where the document is opened
set frmDoc = new frmMainDocument
'
' Again somewhere else
frmDoc.SaveFileToDisk("c:\test.txt")
'
' in the frmMainDocument
public Sub SaveFileToDisk(strPath as string)
Dim FFile as integer
FFile = FreeFile
Open strPath for Output as #FFile
print #FFile, txtOutput.Text
Close #FFile
End Sub
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook