473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 6872
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Luis Gustavo | last post by:
FrameWork 2 Hi. Can anyone say how I prevent the error: "'Function' is not a member of 'System.Windows.Forms.Form'". I have a form where I have many public functions created for me. The...
1
by: dusiapapa | last post by:
Hi everybody! I've already posted this in the "microsoft.public.dotnet.framework.windowsforms". I have windows forms application containing a lot of MDI (shown with ..Show()) and modal (shown...
3
by: c_shah | last post by:
VB 2005 and windows form application I am having difficulty putting my question into words but.. Is there a way to determine whether my win form application has focus or it is active or being...
8
by: Rodrigo Juarez | last post by:
Hi I'm using Visual Studio 2005 with visual basic, developing winforms applications I'm adding try catch blocks for error handling and I want to close the application when I got an error....
3
by: vovan | last post by:
In a new WindowsForm project with default settings I wrote a loop: For Each frm In My.Application.OpenForms If frm.Name <"MDIMain" Then frm.Close() End If Next
2
by: aagarwal8 | last post by:
Hi, I have a chat application which i have created using WinForms 2.0 (C# lang). The situation i am faced with is that i need to close all the opened (chat, public chat, chat invite, chat...
4
by: =?ISO-8859-15?Q?Albe_V=B0?= | last post by:
In my Application, I need to make a certain graphical refresh, interrogating SqlServer, only if Application has focus (i.e. the title bar is blue). Interrogating .Focused property of various...
6
by: pamela fluente | last post by:
Hello friends, I have a simple question. If I have an application with several forms, you see on the windows bar, usually on the bottom of your screen, the various tags for the various forms. ...
4
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
I am trying to close/dispose multiple instances of a form but because they are modal and hidden, they do not show up in My.Application.OpenForms. They must be modal, so making them modeless is not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.