473,325 Members | 2,608 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,325 software developers and data experts.

Windows Forms MainMenu question

Hi,
I have decided to use a MainMenu in my main form. I have a menu item
"Open Form". When this item is clicked I want the "newform.frm" to open just
below the menu in the main form. How can this be done? I am using VB.Net.

Thanks for any replies.

Yoshi
Nov 22 '05 #1
22 1483
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor
Nov 22 '05 #2
J L
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #3
J L
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #4
Thanks for your reply. What code did you use in the click event of the Menu
Item?? What is the code to load the new form in the main form just below the
MainMenu?

Cheers,
Yoshi

"J L" wrote:
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #5
Thanks for your reply. What code did you use in the click event of the Menu
Item?? What is the code to load the new form in the main form just below the
MainMenu?

Cheers,
Yoshi

"J L" wrote:
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #6
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor
Nov 22 '05 #7
yoshimitsu,

There are 3 types of forms in window forms Net

Normal forms, modal forms and Mdi forms.

From your writing I understand it can only be a normal form or a modal form.

A modal form, which is opened with showdialog is much easier to handle than
a normal form that you open as extra form.

A modal form is easier necause that when you open a modal form the user
cannot access the original form while he can with a normal form.

You choose for the last as everybody does in the beginning. However know
that that needs much more expirience to handle all those forms and keep the
information as it has to be.

Therefore give us some information what you want.

Cor
Nov 22 '05 #8
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor
Nov 22 '05 #9
yoshimitsu,

There are 3 types of forms in window forms Net

Normal forms, modal forms and Mdi forms.

From your writing I understand it can only be a normal form or a modal form.

A modal form, which is opened with showdialog is much easier to handle than
a normal form that you open as extra form.

A modal form is easier necause that when you open a modal form the user
cannot access the original form while he can with a normal form.

You choose for the last as everybody does in the beginning. However know
that that needs much more expirience to handle all those forms and keep the
information as it has to be.

Therefore give us some information what you want.

Cor
Nov 22 '05 #10
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com...
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #11
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com...
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #12
J L
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John

On Tue, 24 May 2005 13:10:02 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com.. .
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


Nov 22 '05 #13
J L
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John

On Tue, 24 May 2005 13:10:02 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com.. .
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


Nov 22 '05 #14
J L

Hi Cor,
Yes sometimes I stutter when I type LOL

John

On Tue, 24 May 2005 08:18:40 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor


Nov 22 '05 #15
J L

Hi Cor,
Yes sometimes I stutter when I type LOL

John

On Tue, 24 May 2005 08:18:40 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor


Nov 22 '05 #16
"J L" <jo**@marymonte.com> wrote in message
news:l5********************************@4ax.com...
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John


To expand on the code:

Dim newForm As New Form
newForm.StartPosition = FormStartPosition.Manual
newForm.Left = Me.Left
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top
newForm.ShowDialog(Me)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #17
"J L" <jo**@marymonte.com> wrote in message
news:l5********************************@4ax.com...
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John


To expand on the code:

Dim newForm As New Form
newForm.StartPosition = FormStartPosition.Manual
newForm.Left = Me.Left
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top
newForm.ShowDialog(Me)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #18
J L
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #19
J L
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #20
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"J L" <jo**@marymonte.com> wrote in message
news:9s********************************@4ax.com...
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #21
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"J L" <jo**@marymonte.com> wrote in message
news:9s********************************@4ax.com...
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #22
J L
Hi Mick,
That did the trick I was looking at Intellisense. Thank you so much
for your persistance and support. That works prefectly!!

John

On Fri, 27 May 2005 10:25:25 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General


Nov 22 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ralph Freshour | last post by:
I bought the PHP and MySQL For Dummies book and I'm having trouble understanding how I use PHP to verify and check forms input text data - the book shows snippets of code so I know how to do the...
12
by: yoshimitsu | last post by:
Hi, I have decided to use a MainMenu in my main form. I have a menu item "Open Form". When this item is clicked I want the "newform.frm" to open just below the menu in the main form. How can this...
0
by: Susan Bricker | last post by:
I think I broke something. I am developing a database. I have 13 forms, so when the database window is showing the forms there are two columns with a scroll bar on the bottom. After I open a...
4
by: Sean Connery | last post by:
I know I can merge a child forms menu into the MDI parent's mainmenu, but I would also like to listen for common events fired from the mainmenu that might be of interest to any child forms. Is...
2
by: James CC | last post by:
I have a strange bug in C# using windows forms. To make sure it's not some bug with my code, I've gone back to a simple test app, and still see the same behavior. I have created a simple C#...
9
by: hhh12347 | last post by:
FolderBrowserDialog crashes on my Windows 2000 computer. Here is a C# test program: using System; using System.Windows.Forms; public class TestForm : Form { FolderBrowserDialog...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
8
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.