Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can't change the properties of a MDI form

Posted on 1998-10-08
7
Medium Priority
?
192 Views
Last Modified: 2010-04-30
I have a program that uses a MDI form. I try to change that forms properties just like any other object like
formname.proprety.value or for a better example
form1.caption = "Test"
I get a run time error 426; Only one MDI form allowed.
What should I do? Thanks
0
Comment
Question by:xer_soft
[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
7 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1438928
Error 426 - Only one MDI Form allowed

A project can only have one MDIForm. This error has the following causes and solutions:

You tried to load a file containing an MDIForm into a project that already has an MDIForm in it. Remove the file containing the loaded MDIForm before loading another.

You tried to load a second instance of an MDIForm created with a Dim or Set statement. You can only create one instance of an MDIForm in a project.

0
 
LVL 1

Expert Comment

by:CarlosJac
ID: 1438929
If you has generated the app with Application Wizard:

use fMainForm and not use the mdiform name.
Example:

fMainForm.caption = "Test"


Why?

The app wizard has created a module with sub main:

Sub Main()
    Set fMainForm = New frmMain
    fMainForm.Show
End Sub

If you attempt use frmMain, VB attempt to load the mdiform , but the mdi is already loade.

Good Luck

Sorry, my english is very bad.

0
 
LVL 2

Expert Comment

by:mkmccreary
ID: 1438930
The problem is the way you are referring to the form.  I would have to look at the code to tell you exactly what is going on.  Here is a workaround, though.  It uses the Forms Collection to change the caption:

Dim i as Integer

For i = 0 To Forms.Count
    If Forms(i).Name = "MDIForm1" Then
        Forms(i).Caption = "Test"
        Exit For
    End If
Next i

Just change the name in quotes to the name of your MDI form.

Later,
Martin

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:xer_soft
ID: 1438931
CarlosJac please put you answer down as the answer for as you have helped me the most. Thanks much your way worked great and was very easy. Your english was not that bad! Thanks again!
0
 
LVL 1

Accepted Solution

by:
CarlosJac earned 800 total points
ID: 1438932
If you has generated the app with Application Wizard:

use fMainForm and not use the mdiform name.
Example:

fMainForm.caption = "Test"


Why?

The app wizard has created a module with sub main:

Sub Main()
    Set fMainForm = New frmMain
    fMainForm.Show
End Sub

If you attempt use frmMain, VB attempt to load the mdiform , but the mdi is already loade.

Good Luck

Sorry, my english is very bad.

0
 
LVL 1

Author Comment

by:xer_soft
ID: 1438933
Thanks a bunch!!!!!!!
0
 
LVL 1

Expert Comment

by:CarlosJac
ID: 1438934
not at all
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

715 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