Solved

Using a common MDI form both for standard call and for modal call

Posted on 2002-05-01
5
124 Views
Last Modified: 2010-05-02
Let's say I have form A, that is an MDI form. Let's say it's used to handle customers.
Now I want to have my main menu able to call that A form, and keep it open while I open my... let's say Invoice form where I want to show form A, but in vbModal way (of course if you have formA.mdichild = true then you can't show it vbModal).
The problem is that if I copy the form with a:

Dim B as new FormA

I can't modify the MDIChild property, as it is read-only in run-time.
So, is there a way, different from saving the file and changing the form name to show it both as MDI and as Modal?

Thank you
0
Comment
Question by:DataSol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6984850
The only way I can think of is to dynamically copy the contents of the child form into a standard form which can then be show modally.  The copy would require moving each object to the proper location and making it visible.  This part is easy, but may be a bit slow if you have a lot of controls and have to unload it each time (rather than load it just the first time then leave it hidden.)
0
 

Author Comment

by:DataSol
ID: 6984862
Rspahitz: ok, I can dynamically create the objects on the new form, but what about the code related to events?
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 6984883
Each event would probably have to be predefined (which they are in the child form anyway) and then called.  In that case, maybe the easiest thing to do would be to have every event procedure call a procedure in a new module, like this:
-----
FormA:
-----
Private Sub Command1_Click(Index as Integer)
   MyModule.Command1_Click Me.Name, Index
End Sub

Private Sub Form_Load()
   MyModule.Form_Load Me.Name
End Sub

-----
FormB:
-----
Private Sub Command1_Click(Index as Integer)
   MyModule.Command1_Click Me.Name, Index
End Sub

Private Sub Form_Load()
   MyModule.Form_Load Me.Name
End Sub

-----
MyModule:
-----
Public Sub Command1_Click(FormName as string, Index as Integer)
   if Index = 0 then
     'so something for first index
   else
     ' do something for next index
   endif
End Sub

Public Sub Form_Load(FormName as String)
   if Formname = "FormA" then
     'do something special for form A
   else
     'do something special for form B
   endif
End Sub

---
The references to Formname are optional, but may be useful.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7698702
Hi DataSol,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

DataSol, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7755549
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question