469,917 Members | 1,620 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

My.Application.OpenForms

Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry
Dec 14 '06 #1
13 6451
I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of
My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry


Dec 14 '06 #2
Yes and VS2005 SP1 Beta as follows

Microsoft Visual Studio 2005
Version 8.0.50727.363 (SP.050727-3600)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Professional
Microsoft Visual Basic 2005 77626-009-0000007-41556

When I use the expression, it is immediately underlined in green.

Thanks

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.com. ..
>I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
>Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry



Dec 15 '06 #3
Ah Robin,

I just noticed that in the project Properties, Application tab, the 'enable
application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub Main() as
the starting point for the code.

There is very little clear info on building MDI applications as Microsoft
presumably is not encouraging the MDI framework. (no internal support for
INI files either in vb2005). Just try to resize an MDI child to fit the
Client Rectangle in the parent form exactly. It was all so simple in VB6

However, I wonder if you could 'point' me to relevant and truly constructive
info on MDI applications in VB2005 'cos I MAY have to redefine my
application.

Is there anything else that I may be missing from My.Application if I leave
this checkbox unchecked????? I assume that this checkbox is the source of my
present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green line
background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.com. ..
>I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
>Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry



Dec 15 '06 #4
Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Ah Robin,

I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub Main()
as the starting point for the code.

There is very little clear info on building MDI applications as
Microsoft presumably is not encouraging the MDI framework. (no
internal support for INI files either in vb2005). Just try to resize
an MDI child to fit the Client Rectangle in the parent form exactly.
It was all so simple in VB6

However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.

Is there anything else that I may be missing from My.Application if I
leave this checkbox unchecked????? I assume that this checkbox is the
source of my present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green
line background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.com. ..
>>I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
>>Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of
My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry




Dec 15 '06 #5
>Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I do
change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI client
rectangle BUT, the user must be able to move the form within the parent
form.. My solution is not elegant and I wonder how other people solved it.
Perhaps other programmers do not need to. I do not want the child maximised,
thats too easy, I want the child to completely fill the available area and
yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event being
used in each child form to add it to a User Defined forms collection. I have
to consider this carefully. It was written for VS2003 and the article
specifically states that the 'openforms' is available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non Microsoft
VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that one
of the much taunted features at the release of the .NET languages back in
2002 has not been realised. Garbage Collection is simply not mentioned any
more. I am however, enjoying ADO.NET with SQLCE which has replaced my
original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.com. ..
Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Ah Robin,

I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub Main() as
the starting point for the code.

There is very little clear info on building MDI applications as Microsoft
presumably is not encouraging the MDI framework. (no internal support for
INI files either in vb2005). Just try to resize an MDI child to fit the
Client Rectangle in the parent form exactly. It was all so simple in VB6

However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.

Is there anything else that I may be missing from My.Application if I
leave this checkbox unchecked????? I assume that this checkbox is the
source of my present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green line
background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.com ...
>>>I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of
My.Application???

Dim frm As Form
For Each frm In My.Application.OpenForms

Next frm
Garry




Dec 15 '06 #6
Conservatism is not so bad. I tend to write things to help me
do my job. In one job, my boss was looking over my shoulder at
the app I'd written for myself, and wanted it. By the end of
the month, it had propagated to 50 people, and turned out to be
one of the most popular things I'd written. Pretty entertaining.

I haven't solved the problem you've discussed about sizing the
child form to the max size w/o maxinimizing it. Maybe your
solution is the best (and only).

I heard on one of the DotNetRocks podcasts that the guy who
wrote Salamander (a product, IIRC, that will turn your
installed apps back into code, so you should use an obfuscator)
has also managed to port .Net to a Unix machine. He said it's
working pretty good, but isn't ready for prime time. It was
interesting.

Sorry you're missing the VB6 IDE; I'm enjoying .Net. It was
worth the upgrade for the data binding alone as far as I'm
concerned. :-) And Generics. (OOP goes w/o saying.)

Good luck.
Robin S.
--------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I
do change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI
client rectangle BUT, the user must be able to move the form within
the parent form.. My solution is not elegant and I wonder how other
people solved it. Perhaps other programmers do not need to. I do not
want the child maximised, thats too easy, I want the child to
completely fill the available area and yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event
being used in each child form to add it to a User Defined forms
collection. I have to consider this carefully. It was written for
VS2003 and the article specifically states that the 'openforms' is
available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non
Microsoft VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that
one of the much taunted features at the release of the .NET languages
back in 2002 has not been realised. Garbage Collection is simply not
mentioned any more. I am however, enjoying ADO.NET with SQLCE which
has replaced my original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.com. ..
>Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Ah Robin,

I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub
Main() as the starting point for the code.

There is very little clear info on building MDI applications as
Microsoft presumably is not encouraging the MDI framework. (no
internal support for INI files either in vb2005). Just try to resize
an MDI child to fit the Client Rectangle in the parent form exactly.
It was all so simple in VB6

However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.

Is there anything else that I may be missing from My.Application if
I leave this checkbox unchecked????? I assume that this checkbox is
the source of my present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when
using Cntrl-Break to debug, the Sub Main() is always shown with the
green line background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.co m...
I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of
My.Application???
>
Dim frm As Form
For Each frm In My.Application.OpenForms
>
Next frm
>
>
Garry
>





Dec 16 '06 #7
Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I do
change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI client
rectangle BUT, the user must be able to move the form within the parent
form.. My solution is not elegant and I wonder how other people solved it.
Perhaps other programmers do not need to. I do not want the child
maximised, thats too easy, I want the child to completely fill the
available area and yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event being
used in each child form to add it to a User Defined forms collection. I
have to consider this carefully. It was written for VS2003 and the article
specifically states that the 'openforms' is available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non Microsoft
VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that one
of the much taunted features at the release of the .NET languages back in
2002 has not been realised. Garbage Collection is simply not mentioned any
more. I am however, enjoying ADO.NET with SQLCE which has replaced my
original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.com. ..
>Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Ah Robin,

I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub Main()
as the starting point for the code.

There is very little clear info on building MDI applications as
Microsoft presumably is not encouraging the MDI framework. (no internal
support for INI files either in vb2005). Just try to resize an MDI child
to fit the Client Rectangle in the parent form exactly. It was all so
simple in VB6

However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.

Is there anything else that I may be missing from My.Application if I
leave this checkbox unchecked????? I assume that this checkbox is the
source of my present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green line
background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.co m...
I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?

Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl...
Why is it that my installation od vs2005 will not accept
My.Application.OpenForms saying that it is not part of
My.Application???
>
Dim frm As Form
For Each frm In My.Application.OpenForms
>
Next frm
>
>
Garry
>





Dec 16 '06 #8
Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
>Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I do
change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI client
rectangle BUT, the user must be able to move the form within the parent
form.. My solution is not elegant and I wonder how other people solved
it. Perhaps other programmers do not need to. I do not want the child
maximised, thats too easy, I want the child to completely fill the
available area and yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event being
used in each child form to add it to a User Defined forms collection. I
have to consider this carefully. It was written for VS2003 and the
article specifically states that the 'openforms' is available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non Microsoft
VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that
one of the much taunted features at the release of the .NET languages
back in 2002 has not been realised. Garbage Collection is simply not
mentioned any more. I am however, enjoying ADO.NET with SQLCE which has
replaced my original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.com ...
>>Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
Ah Robin,

I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.

I did this to enable me to build an MDI application and use sub Main()
as the starting point for the code.

There is very little clear info on building MDI applications as
Microsoft presumably is not encouraging the MDI framework. (no internal
support for INI files either in vb2005). Just try to resize an MDI
child to fit the Client Rectangle in the parent form exactly. It was
all so simple in VB6

However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.

Is there anything else that I may be missing from My.Application if I
leave this checkbox unchecked????? I assume that this checkbox is the
source of my present troubles.

I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.

One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green
line background on Application.Run(frmMain)..

Any clear suggestions would be much appreciated.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast.c om...
>I hate to ask the obvious, but is it a Windows Forms application
that you're trying to use it in?
>
Robin S.
----------------------------
"Garry" <ga**********@gmail.comwrote in message
news:uH**************@TK2MSFTNGP02.phx.gbl.. .
>Why is it that my installation od vs2005 will not accept
>My.Application.OpenForms saying that it is not part of
>My.Application???
>>
>Dim frm As Form
>For Each frm In My.Application.OpenForms
>>
>Next frm
>>
>>
>Garry
>>
>
>
>




Dec 16 '06 #9
I hit hit F1, switched to the index tab, typed in 'mdiclient', selected
'about MdiClient class', noticed that it it derived from
System.Windows.Forms.Control, scrolled down a bit and read the remarks,
tried a stock standard 'controls loop' to check that it was actually
present, then had a look at the members to find a suitable property or
method.

BTW. It doesn't work if the StartPosition property of Form2 is set to
WindowsDefaultsBounds.
"Garry" <ga**********@gmail.comwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply
INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
>Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
>>Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I do
change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI client
rectangle BUT, the user must be able to move the form within the parent
form.. My solution is not elegant and I wonder how other people solved
it. Perhaps other programmers do not need to. I do not want the child
maximised, thats too easy, I want the child to completely fill the
available area and yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event being
used in each child form to add it to a User Defined forms collection. I
have to consider this carefully. It was written for VS2003 and the
article specifically states that the 'openforms' is available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non
Microsoft VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that
one of the much taunted features at the release of the .NET languages
back in 2002 has not been realised. Garbage Collection is simply not
mentioned any more. I am however, enjoying ADO.NET with SQLCE which has
replaced my original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.co m...
Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.

I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?

Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl. ..
Ah Robin,
>
I just noticed that in the project Properties, Application tab, the
'enable application framework' checkbox is unchecked.
>
I did this to enable me to build an MDI application and use sub Main()
as the starting point for the code.
>
There is very little clear info on building MDI applications as
Microsoft presumably is not encouraging the MDI framework. (no
internal support for INI files either in vb2005). Just try to resize
an MDI child to fit the Client Rectangle in the parent form exactly.
It was all so simple in VB6
>
However, I wonder if you could 'point' me to relevant and truly
constructive info on MDI applications in VB2005 'cos I MAY have to
redefine my application.
>
Is there anything else that I may be missing from My.Application if I
leave this checkbox unchecked????? I assume that this checkbox is the
source of my present troubles.
>
I am re-writing completely from VB6, NOT converting and do not feel
comfortable with the frmMain as the StartUp object.
>
One of the disadvantages of unchecking the checkbox is that when using
Cntrl-Break to debug, the Sub Main() is always shown with the green
line background on Application.Run(frmMain)..
>
Any clear suggestions would be much appreciated.
>
Garry
>
>
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:P4******************************@comcast. com...
>>I hate to ask the obvious, but is it a Windows Forms application
>that you're trying to use it in?
>>
>Robin S.
>----------------------------
>"Garry" <ga**********@gmail.comwrote in message
>news:uH**************@TK2MSFTNGP02.phx.gbl. ..
>>Why is it that my installation od vs2005 will not accept
>>My.Application.OpenForms saying that it is not part of
>>My.Application???
>>>
>>Dim frm As Form
>>For Each frm In My.Application.OpenForms
>>>
>>Next frm
>>>
>>>
>>Garry
>>>
>>
>>
>>
>
>




Dec 16 '06 #10
OK.

I tried the solution Stephany but the results were not quite as I expected.

The code was revised as

Shared Sub A_ResizeToFit(ByVal frmMain As Form, ByVal _f As Form)
' parent the form the the MDI Container
_f.MdiParent = frmMain

' make the form fill the client area of the MDI Container
For Each _c As Control In frmMain.Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next
_f.Show()
End Sub

Which I think you will agree is correct with small name changes. The result
was a cascaded arrangement whereby the first mdi child generated was at a
small displacement and each subsequent MDI child generated at a furthur
displacement.

I solved the problem with the following code which you may or may not make
use of. It is a function which can be placed in a class and has a
displacement from the left to allow a Tree navigator as a separate MDI child
to be displayed alongside the MDI child.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByRef frmChild As Form, ByVal
lngTreeWidth As Long)

Dim lngTop As Long
Dim lngLeft As Long
Dim lngWidth As Long
Dim lngHeight As Long
frmChild.Dock = DockStyle.Fill

frmChild.Show() 'Do a 'show' to capture the true size and position of
the MDI child before removing the DockStyle.Fill
lngTop = frmChild.Top
lngLeft = frmChild.Left
lngWidth = frmChild.Width
lngHeight = frmChild.Height
frmChild.Dock = DockStyle.None

'Now manipulate the form to size and position - it can be resized by the
user anytime as it is now DockStyle.None
frmChild.Top = lngTop
frmChild.Left = lngLeft + lngTreeWidth
frmChild.Width = lngWidth - lngTreeWidth
frmChild.Height = lngHeight

End Sub

BUT
It causes a flicker which is not to my liking.
I was all so simple in VB6 and I find this code, to say the least - gross.

Your's was much more elegant but did not give me the required results that I
needed. It was however a valid attempt and thank you for that. I have
learned something.

Thanks again

Garry
..

"Stephany Young" <noone@localhostwrote in message
news:e4**************@TK2MSFTNGP06.phx.gbl...
>I hit hit F1, switched to the index tab, typed in 'mdiclient', selected
'about MdiClient class', noticed that it it derived from
System.Windows.Forms.Control, scrolled down a bit and read the remarks,
tried a stock standard 'controls loop' to check that it was actually
present, then had a look at the members to find a suitable property or
method.

BTW. It doesn't work if the StartPosition property of Form2 is set to
WindowsDefaultsBounds.
"Garry" <ga**********@gmail.comwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
>Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply
INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
>>Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.

The problem is not the Startup but I will remember your comment if I do
change back to frmMain as the start form.

Have you solved the problem of sizing a child form to fit the MDI
client rectangle BUT, the user must be able to move the form within the
parent form.. My solution is not elegant and I wonder how other people
solved it. Perhaps other programmers do not need to. I do not want the
child maximised, thats too easy, I want the child to completely fill
the available area and yet be 'moveable'.

I saw a solution to a forms collection in code with the Load event
being used in each child form to add it to a User Defined forms
collection. I have to consider this carefully. It was written for
VS2003 and the article specifically states that the 'openforms' is
available in 2005.

I say it again - things were so simple in VB6.

If only someone had uddated the VB6 GUI and come out with a non
Microsoft VB7 with the improved intellisense on vb2005.

A DOTNET framework for Linux or Mackintosh has not materalised so that
one of the much taunted features at the release of the .NET languages
back in 2002 has not been realised. Garbage Collection is simply not
mentioned any more. I am however, enjoying ADO.NET with SQLCE which has
replaced my original Access database. Very fast.

Anyway, thanks for your answers.

Garry

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast.c om...
Unfortunately, I figured out MDI stuff by trial & error, and
the ones I've written are fairly simple. I do have MacDonald's
Windows Forms book; it has some basic info on MDI, but not tons.
You could always search Google.
>
I have the startup form for my project set to the parent form.
Why do you hesitate to have a form as your startup?
>
Robin S.
-------------------------------
"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
>Ah Robin,
>>
>I just noticed that in the project Properties, Application tab, the
>'enable application framework' checkbox is unchecked.
>>
>I did this to enable me to build an MDI application and use sub
>Main() as the starting point for the code.
>>
>There is very little clear info on building MDI applications as
>Microsoft presumably is not encouraging the MDI framework. (no
>internal support for INI files either in vb2005). Just try to resize
>an MDI child to fit the Client Rectangle in the parent form exactly.
>It was all so simple in VB6
>>
>However, I wonder if you could 'point' me to relevant and truly
>constructive info on MDI applications in VB2005 'cos I MAY have to
>redefine my application.
>>
>Is there anything else that I may be missing from My.Application if I
>leave this checkbox unchecked????? I assume that this checkbox is the
>source of my present troubles.
>>
>I am re-writing completely from VB6, NOT converting and do not feel
>comfortable with the frmMain as the StartUp object.
>>
>One of the disadvantages of unchecking the checkbox is that when
>using Cntrl-Break to debug, the Sub Main() is always shown with the
>green line background on Application.Run(frmMain)..
>>
>Any clear suggestions would be much appreciated.
>>
>Garry
>>
>>
>"RobinS" <Ro****@NoSpam.yah.nonewrote in message
>news:P4******************************@comcast .com...
>>>I hate to ask the obvious, but is it a Windows Forms application
>>that you're trying to use it in?
>>>
>>Robin S.
>>----------------------------
>>"Garry" <ga**********@gmail.comwrote in message
>>news:uH**************@TK2MSFTNGP02.phx.gbl.. .
>>>Why is it that my installation od vs2005 will not accept
>>>My.Application.OpenForms saying that it is not part of
>>>My.Application???
>>>>
>>>Dim frm As Form
>>>For Each frm In My.Application.OpenForms
>>>>
>>>Next frm
>>>>
>>>>
>>>Garry
>>>>
>>>
>>>
>>>
>>
>>
>
>




Dec 17 '06 #11
Ok, so I made a little mistake. It does work if the StartPosition property
of Form2 is set to
Manual or CenterScreen. It doesn't work if it is set to anything else. I
thought that the fact that it didn't work for one setting might have led you
to investigate the others.

If you start manipulating the position of MDI Child forms after they have
been shown then you WILL get flicker as the repaints occur.
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
OK.

I tried the solution Stephany but the results were not quite as I
expected.

The code was revised as

Shared Sub A_ResizeToFit(ByVal frmMain As Form, ByVal _f As Form)
' parent the form the the MDI Container
_f.MdiParent = frmMain

' make the form fill the client area of the MDI Container
For Each _c As Control In frmMain.Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next
_f.Show()
End Sub

Which I think you will agree is correct with small name changes. The
result was a cascaded arrangement whereby the first mdi child generated
was at a small displacement and each subsequent MDI child generated at a
furthur displacement.

I solved the problem with the following code which you may or may not make
use of. It is a function which can be placed in a class and has a
displacement from the left to allow a Tree navigator as a separate MDI
child to be displayed alongside the MDI child.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByRef frmChild As Form,
ByVal lngTreeWidth As Long)

Dim lngTop As Long
Dim lngLeft As Long
Dim lngWidth As Long
Dim lngHeight As Long
frmChild.Dock = DockStyle.Fill

frmChild.Show() 'Do a 'show' to capture the true size and position of
the MDI child before removing the DockStyle.Fill
lngTop = frmChild.Top
lngLeft = frmChild.Left
lngWidth = frmChild.Width
lngHeight = frmChild.Height
frmChild.Dock = DockStyle.None

'Now manipulate the form to size and position - it can be resized by
the user anytime as it is now DockStyle.None
frmChild.Top = lngTop
frmChild.Left = lngLeft + lngTreeWidth
frmChild.Width = lngWidth - lngTreeWidth
frmChild.Height = lngHeight

End Sub

BUT
It causes a flicker which is not to my liking.
I was all so simple in VB6 and I find this code, to say the least - gross.

Your's was much more elegant but did not give me the required results that
I needed. It was however a valid attempt and thank you for that. I have
learned something.

Thanks again

Garry
.

"Stephany Young" <noone@localhostwrote in message
news:e4**************@TK2MSFTNGP06.phx.gbl...
>>I hit hit F1, switched to the index tab, typed in 'mdiclient', selected
'about MdiClient class', noticed that it it derived from
System.Windows.Forms.Control, scrolled down a bit and read the remarks,
tried a stock standard 'controls loop' to check that it was actually
present, then had a look at the members to find a suitable property or
method.

BTW. It doesn't work if the StartPosition property of Form2 is set to
WindowsDefaultsBounds.
"Garry" <ga**********@gmail.comwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
>>Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply
INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.
>
The problem is not the Startup but I will remember your comment if I
do change back to frmMain as the start form.
>
Have you solved the problem of sizing a child form to fit the MDI
client rectangle BUT, the user must be able to move the form within
the parent form.. My solution is not elegant and I wonder how other
people solved it. Perhaps other programmers do not need to. I do not
want the child maximised, thats too easy, I want the child to
completely fill the available area and yet be 'moveable'.
>
I saw a solution to a forms collection in code with the Load event
being used in each child form to add it to a User Defined forms
collection. I have to consider this carefully. It was written for
VS2003 and the article specifically states that the 'openforms' is
available in 2005.
>
I say it again - things were so simple in VB6.
>
If only someone had uddated the VB6 GUI and come out with a non
Microsoft VB7 with the improved intellisense on vb2005.
>
A DOTNET framework for Linux or Mackintosh has not materalised so that
one of the much taunted features at the release of the .NET languages
back in 2002 has not been realised. Garbage Collection is simply not
mentioned any more. I am however, enjoying ADO.NET with SQLCE which
has replaced my original Access database. Very fast.
>
Anyway, thanks for your answers.
>
Garry
>
>
>
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast. com...
>Unfortunately, I figured out MDI stuff by trial & error, and
>the ones I've written are fairly simple. I do have MacDonald's
>Windows Forms book; it has some basic info on MDI, but not tons.
>You could always search Google.
>>
>I have the startup form for my project set to the parent form.
>Why do you hesitate to have a form as your startup?
>>
>Robin S.
>-------------------------------
>"Garry" <ga**********@gmail.comwrote in message
>news:%2****************@TK2MSFTNGP06.phx.gbl. ..
>>Ah Robin,
>>>
>>I just noticed that in the project Properties, Application tab, the
>>'enable application framework' checkbox is unchecked.
>>>
>>I did this to enable me to build an MDI application and use sub
>>Main() as the starting point for the code.
>>>
>>There is very little clear info on building MDI applications as
>>Microsoft presumably is not encouraging the MDI framework. (no
>>internal support for INI files either in vb2005). Just try to resize
>>an MDI child to fit the Client Rectangle in the parent form exactly.
>>It was all so simple in VB6
>>>
>>However, I wonder if you could 'point' me to relevant and truly
>>constructive info on MDI applications in VB2005 'cos I MAY have to
>>redefine my application.
>>>
>>Is there anything else that I may be missing from My.Application if
>>I leave this checkbox unchecked????? I assume that this checkbox is
>>the source of my present troubles.
>>>
>>I am re-writing completely from VB6, NOT converting and do not feel
>>comfortable with the frmMain as the StartUp object.
>>>
>>One of the disadvantages of unchecking the checkbox is that when
>>using Cntrl-Break to debug, the Sub Main() is always shown with the
>>green line background on Application.Run(frmMain)..
>>>
>>Any clear suggestions would be much appreciated.
>>>
>>Garry
>>>
>>>
>>"RobinS" <Ro****@NoSpam.yah.nonewrote in message
>>news:P4******************************@comcas t.com...
>>>>I hate to ask the obvious, but is it a Windows Forms application
>>>that you're trying to use it in?
>>>>
>>>Robin S.
>>>----------------------------
>>>"Garry" <ga**********@gmail.comwrote in message
>>>news:uH**************@TK2MSFTNGP02.phx.gbl. ..
>>>>Why is it that my installation od vs2005 will not accept
>>>>My.Application.OpenForms saying that it is not part of
>>>>My.Application???
>>>>>
>>>>Dim frm As Form
>>>>For Each frm In My.Application.OpenForms
>>>>>
>>>>Next frm
>>>>>
>>>>>
>>>>Garry
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Dec 17 '06 #12
Yes,

Thank you Stephany.

That does work now.

I moved the .Show() to end of any further manipulations and the resultant
DISPLAY was perfect

Thanks very much again.

Garry
"Stephany Young" <noone@localhostwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Ok, so I made a little mistake. It does work if the StartPosition property
of Form2 is set to
Manual or CenterScreen. It doesn't work if it is set to anything else. I
thought that the fact that it didn't work for one setting might have led
you to investigate the others.

If you start manipulating the position of MDI Child forms after they have
been shown then you WILL get flicker as the repaints occur.
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
>OK.

I tried the solution Stephany but the results were not quite as I
expected.

The code was revised as

Shared Sub A_ResizeToFit(ByVal frmMain As Form, ByVal _f As Form)
' parent the form the the MDI Container
_f.MdiParent = frmMain

' make the form fill the client area of the MDI Container
For Each _c As Control In frmMain.Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next
_f.Show()
End Sub

Which I think you will agree is correct with small name changes. The
result was a cascaded arrangement whereby the first mdi child generated
was at a small displacement and each subsequent MDI child generated at a
furthur displacement.

I solved the problem with the following code which you may or may not
make use of. It is a function which can be placed in a class and has a
displacement from the left to allow a Tree navigator as a separate MDI
child to be displayed alongside the MDI child.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByRef frmChild As Form,
ByVal lngTreeWidth As Long)

Dim lngTop As Long
Dim lngLeft As Long
Dim lngWidth As Long
Dim lngHeight As Long
frmChild.Dock = DockStyle.Fill

frmChild.Show() 'Do a 'show' to capture the true size and position of
the MDI child before removing the DockStyle.Fill
lngTop = frmChild.Top
lngLeft = frmChild.Left
lngWidth = frmChild.Width
lngHeight = frmChild.Height
frmChild.Dock = DockStyle.None

'Now manipulate the form to size and position - it can be resized by
the user anytime as it is now DockStyle.None
frmChild.Top = lngTop
frmChild.Left = lngLeft + lngTreeWidth
frmChild.Width = lngWidth - lngTreeWidth
frmChild.Height = lngHeight

End Sub

BUT
It causes a flicker which is not to my liking.
I was all so simple in VB6 and I find this code, to say the least -
gross.

Your's was much more elegant but did not give me the required results
that I needed. It was however a valid attempt and thank you for that. I
have learned something.

Thanks again

Garry
.

"Stephany Young" <noone@localhostwrote in message
news:e4**************@TK2MSFTNGP06.phx.gbl...
>>>I hit hit F1, switched to the index tab, typed in 'mdiclient', selected
'about MdiClient class', noticed that it it derived from
System.Windows.Forms.Control, scrolled down a bit and read the remarks,
tried a stock standard 'controls loop' to check that it was actually
present, then had a look at the members to find a suitable property or
method.

BTW. It doesn't work if the StartPosition property of Form2 is set to
WindowsDefaultsBounds.
"Garry" <ga**********@gmail.comwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply
INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
Leesten veeeery carefully. I shall say theees only vonce!
>
Dim _f As New Form2
>
' parent the form the the MDI Container
_f.MdiParent = Me
>
' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next
>
_f.Show()
>
Et voila!!!!!!!!!!
>
>
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl.. .
>Why do you hesitate to have a form as your startup?
>Conservatism - an abominable affliction in a computer programmer.
>>
>The problem is not the Startup but I will remember your comment if I
>do change back to frmMain as the start form.
>>
>Have you solved the problem of sizing a child form to fit the MDI
>client rectangle BUT, the user must be able to move the form within
>the parent form.. My solution is not elegant and I wonder how other
>people solved it. Perhaps other programmers do not need to. I do not
>want the child maximised, thats too easy, I want the child to
>completely fill the available area and yet be 'moveable'.
>>
>I saw a solution to a forms collection in code with the Load event
>being used in each child form to add it to a User Defined forms
>collection. I have to consider this carefully. It was written for
>VS2003 and the article specifically states that the 'openforms' is
>available in 2005.
>>
>I say it again - things were so simple in VB6.
>>
>If only someone had uddated the VB6 GUI and come out with a non
>Microsoft VB7 with the improved intellisense on vb2005.
>>
>A DOTNET framework for Linux or Mackintosh has not materalised so
>that one of the much taunted features at the release of the .NET
>languages back in 2002 has not been realised. Garbage Collection is
>simply not mentioned any more. I am however, enjoying ADO.NET with
>SQLCE which has replaced my original Access database. Very fast.
>>
>Anyway, thanks for your answers.
>>
>Garry
>>
>>
>>
>"RobinS" <Ro****@NoSpam.yah.nonewrote in message
>news:F8******************************@comcast .com...
>>Unfortunately, I figured out MDI stuff by trial & error, and
>>the ones I've written are fairly simple. I do have MacDonald's
>>Windows Forms book; it has some basic info on MDI, but not tons.
>>You could always search Google.
>>>
>>I have the startup form for my project set to the parent form.
>>Why do you hesitate to have a form as your startup?
>>>
>>Robin S.
>>-------------------------------
>>"Garry" <ga**********@gmail.comwrote in message
>>news:%2****************@TK2MSFTNGP06.phx.gbl ...
>>>Ah Robin,
>>>>
>>>I just noticed that in the project Properties, Application tab, the
>>>'enable application framework' checkbox is unchecked.
>>>>
>>>I did this to enable me to build an MDI application and use sub
>>>Main() as the starting point for the code.
>>>>
>>>There is very little clear info on building MDI applications as
>>>Microsoft presumably is not encouraging the MDI framework. (no
>>>internal support for INI files either in vb2005). Just try to
>>>resize an MDI child to fit the Client Rectangle in the parent form
>>>exactly. It was all so simple in VB6
>>>>
>>>However, I wonder if you could 'point' me to relevant and truly
>>>constructive info on MDI applications in VB2005 'cos I MAY have to
>>>redefine my application.
>>>>
>>>Is there anything else that I may be missing from My.Application if
>>>I leave this checkbox unchecked????? I assume that this checkbox is
>>>the source of my present troubles.
>>>>
>>>I am re-writing completely from VB6, NOT converting and do not feel
>>>comfortable with the frmMain as the StartUp object.
>>>>
>>>One of the disadvantages of unchecking the checkbox is that when
>>>using Cntrl-Break to debug, the Sub Main() is always shown with the
>>>green line background on Application.Run(frmMain)..
>>>>
>>>Any clear suggestions would be much appreciated.
>>>>
>>>Garry
>>>>
>>>>
>>>"RobinS" <Ro****@NoSpam.yah.nonewrote in message
>>>news:P4******************************@comca st.com...
>>>>>I hate to ask the obvious, but is it a Windows Forms application
>>>>that you're trying to use it in?
>>>>>
>>>>Robin S.
>>>>----------------------------
>>>>"Garry" <ga**********@gmail.comwrote in message
>>>>news:uH**************@TK2MSFTNGP02.phx.gbl ...
>>>>>Why is it that my installation od vs2005 will not accept
>>>>>My.Application.OpenForms saying that it is not part of
>>>>>My.Application???
>>>>>>
>>>>>Dim frm As Form
>>>>>For Each frm In My.Application.OpenForms
>>>>>>
>>>>>Next frm
>>>>>>
>>>>>>
>>>>>Garry
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Dec 18 '06 #13
This is great stuff. i mucked around all day with some other things.

Garry, do you use a combination of Stephany's code and yours? where do
you place the call to the size routine?

It was much simpler in VB6

Garry wrote:
Yes,

Thank you Stephany.

That does work now.

I moved the .Show() to end of any further manipulations and the resultant
DISPLAY was perfect

Thanks very much again.

Garry
"Stephany Young" <noone@localhostwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Ok, so I made a little mistake. It does work if the StartPosition property
of Form2 is set to
Manual or CenterScreen. It doesn't work if it is set to anything else. I
thought that the fact that it didn't work for one setting might have led
you to investigate the others.

If you start manipulating the position of MDI Child forms after they have
been shown then you WILL get flicker as the repaints occur.
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
OK.

I tried the solution Stephany but the results were not quite as I
expected.

The code was revised as

Shared Sub A_ResizeToFit(ByVal frmMain As Form, ByVal _f As Form)
' parent the form the the MDI Container
_f.MdiParent = frmMain

' make the form fill the client area of the MDI Container
For Each _c As Control In frmMain.Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next
_f.Show()
End Sub

Which I think you will agree is correct with small name changes. The
result was a cascaded arrangement whereby the first mdi child generated
was at a small displacement and each subsequent MDI child generated at a
furthur displacement.

I solved the problem with the following code which you may or may not
make use of. It is a function which can be placed in a class and has a
displacement from the left to allow a Tree navigator as a separate MDI
child to be displayed alongside the MDI child.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByRef frmChild As Form,
ByVal lngTreeWidth As Long)

Dim lngTop As Long
Dim lngLeft As Long
Dim lngWidth As Long
Dim lngHeight As Long
frmChild.Dock = DockStyle.Fill

frmChild.Show() 'Do a 'show' to capture the true size and position of
the MDI child before removing the DockStyle.Fill
lngTop = frmChild.Top
lngLeft = frmChild.Left
lngWidth = frmChild.Width
lngHeight = frmChild.Height
frmChild.Dock = DockStyle.None

'Now manipulate the form to size and position - it can be resized by
the user anytime as it is now DockStyle.None
frmChild.Top = lngTop
frmChild.Left = lngLeft + lngTreeWidth
frmChild.Width = lngWidth - lngTreeWidth
frmChild.Height = lngHeight

End Sub

BUT
It causes a flicker which is not to my liking.
I was all so simple in VB6 and I find this code, to say the least -
gross.

Your's was much more elegant but did not give me the required results
that I needed. It was however a valid attempt and thank you for that. I
have learned something.

Thanks again

Garry
.

"Stephany Young" <noone@localhostwrote in message
news:e4**************@TK2MSFTNGP06.phx.gbl...
I hit hit F1, switched to the index tab, typed in 'mdiclient', selected
'about MdiClient class', noticed that it it derived from
System.Windows.Forms.Control, scrolled down a bit and read the remarks,
tried a stock standard 'controls loop' to check that it was actually
present, then had a look at the members to find a suitable property or
method.

BTW. It doesn't work if the StartPosition property of Form2 is set to
WindowsDefaultsBounds.
"Garry" <ga**********@gmail.comwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
Thank you Stephany,

Will try and re-post.

Assuming that it werks, where did U get it or woz it simply
INTUITIVE???????

Garry


"Stephany Young" <noone@localhostwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
Leesten veeeery carefully. I shall say theees only vonce!

Dim _f As New Form2

' parent the form the the MDI Container
_f.MdiParent = Me

' make the form fill the client area of the MDI Container
For Each _c As Control In Controls
If _c.GetType Is GetType(MdiClient) Then
_f.Bounds = CType(_c, MdiClient).ClientRectangle
Exit For
End If
Next

_f.Show()

Et voila!!!!!!!!!!
"Garry" <ga**********@gmail.comwrote in message
news:uC**************@TK2MSFTNGP03.phx.gbl...
Why do you hesitate to have a form as your startup?
Conservatism - an abominable affliction in a computer programmer.
>
The problem is not the Startup but I will remember your comment if I
do change back to frmMain as the start form.
>
Have you solved the problem of sizing a child form to fit the MDI
client rectangle BUT, the user must be able to move the form within
the parent form.. My solution is not elegant and I wonder how other
people solved it. Perhaps other programmers do not need to. I do not
want the child maximised, thats too easy, I want the child to
completely fill the available area and yet be 'moveable'.
>
I saw a solution to a forms collection in code with the Load event
being used in each child form to add it to a User Defined forms
collection. I have to consider this carefully. It was written for
VS2003 and the article specifically states that the 'openforms' is
available in 2005.
>
I say it again - things were so simple in VB6.
>
If only someone had uddated the VB6 GUI and come out with a non
Microsoft VB7 with the improved intellisense on vb2005.
>
A DOTNET framework for Linux or Mackintosh has not materalised so
that one of the much taunted features at the release of the .NET
languages back in 2002 has not been realised. Garbage Collection is
simply not mentioned any more. I am however, enjoying ADO.NET with
SQLCE which has replaced my original Access database. Very fast.
>
Anyway, thanks for your answers.
>
Garry
>
>
>
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:F8******************************@comcast. com...
>Unfortunately, I figured out MDI stuff by trial & error, and
>the ones I've written are fairly simple. I do have MacDonald's
>Windows Forms book; it has some basic info on MDI, but not tons.
>You could always search Google.
>>
>I have the startup form for my project set to the parent form.
>Why do you hesitate to have a form as your startup?
>>
>Robin S.
>-------------------------------
>"Garry" <ga**********@gmail.comwrote in message
>news:%2****************@TK2MSFTNGP06.phx.gbl. ..
>>Ah Robin,
>>>
>>I just noticed that in the project Properties, Application tab, the
>>'enable application framework' checkbox is unchecked.
>>>
>>I did this to enable me to build an MDI application and use sub
>>Main() as the starting point for the code.
>>>
>>There is very little clear info on building MDI applications as
>>Microsoft presumably is not encouraging the MDI framework. (no
>>internal support for INI files either in vb2005). Just try to
>>resize an MDI child to fit the Client Rectangle in the parent form
>>exactly. It was all so simple in VB6
>>>
>>However, I wonder if you could 'point' me to relevant and truly
>>constructive info on MDI applications in VB2005 'cos I MAY have to
>>redefine my application.
>>>
>>Is there anything else that I may be missing from My.Application if
>>I leave this checkbox unchecked????? I assume that this checkbox is
>>the source of my present troubles.
>>>
>>I am re-writing completely from VB6, NOT converting and do not feel
>>comfortable with the frmMain as the StartUp object.
>>>
>>One of the disadvantages of unchecking the checkbox is that when
>>using Cntrl-Break to debug, the Sub Main() is always shown with the
>>green line background on Application.Run(frmMain)..
>>>
>>Any clear suggestions would be much appreciated.
>>>
>>Garry
>>>
>>>
>>"RobinS" <Ro****@NoSpam.yah.nonewrote in message
>>news:P4******************************@comcas t.com...
>>>>I hate to ask the obvious, but is it a Windows Forms application
>>>that you're trying to use it in?
>>>>
>>>Robin S.
>>>----------------------------
>>>"Garry" <ga**********@gmail.comwrote in message
>>>news:uH**************@TK2MSFTNGP02.phx.gbl. ..
>>>>Why is it that my installation od vs2005 will not accept
>>>>My.Application.OpenForms saying that it is not part of
>>>>My.Application???
>>>>>
>>>>Dim frm As Form
>>>>For Each frm In My.Application.OpenForms
>>>>>
>>>>Next frm
>>>>>
>>>>>
>>>>Garry
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Jan 4 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Luis Gustavo | last post: by
8 posts views Thread by Rodrigo Juarez | last post: by
3 posts views Thread by vovan | last post: by
2 posts views Thread by aagarwal8 | last post: by
4 posts views Thread by =?ISO-8859-15?Q?Albe_V=B0?= | last post: by
4 posts views Thread by =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.