468,140 Members | 1,464 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Adding ToolBar to an existing form...

I have hopefully a simple problem in C#.

I designed a form with a listview on left, vert splitter against that, then
the remainder of the form from top to bottom: a listview, horiz splitter and
tab control (very similar to outlook express).

I then started coding and realised that I needed to add a ToolBar. When I
added this, it didn't appear at the top as expected, but at the top of the
tab control and I couldn't get it to appear where I wanted it to!

Can anybody explain how to get the toolbar to the top of the form easily?

TIA

- Andy

Nov 15 '05 #1
7 2073
Tom
Maybe you don't have the Z-order the way you want it. Try right clicking on
the Toolbar and selecting the "Send to Back" menu item. If that doesn't
take the toolbar to the top of the form, you probably sited it somewhere
other than on the form. I'd undock my other controls, move them down a bit,
then drag and drop (not cut and paste, or you may lose the toolbar contents)
the toolbar onto the main form.

Hope this helps.

Tom Clement
Apptero, Inc.

"Andy Bates" <An********@UltimateSoftwareSolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have hopefully a simple problem in C#.

I designed a form with a listview on left, vert splitter against that, then the remainder of the form from top to bottom: a listview, horiz splitter and tab control (very similar to outlook express).

I then started coding and realised that I needed to add a ToolBar. When I
added this, it didn't appear at the top as expected, but at the top of the
tab control and I couldn't get it to appear where I wanted it to!

Can anybody explain how to get the toolbar to the top of the form easily?

TIA

- Andy

Nov 15 '05 #2
Tom
Maybe you don't have the Z-order the way you want it. Try right clicking on
the Toolbar and selecting the "Send to Back" menu item. If that doesn't
take the toolbar to the top of the form, you probably sited it somewhere
other than on the form. I'd undock my other controls, move them down a bit,
then drag and drop (not cut and paste, or you may lose the toolbar contents)
the toolbar onto the main form.

Hope this helps.

Tom Clement
Apptero, Inc.

"Andy Bates" <An********@UltimateSoftwareSolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have hopefully a simple problem in C#.

I designed a form with a listview on left, vert splitter against that, then the remainder of the form from top to bottom: a listview, horiz splitter and tab control (very similar to outlook express).

I then started coding and realised that I needed to add a ToolBar. When I
added this, it didn't appear at the top as expected, but at the top of the
tab control and I couldn't get it to appear where I wanted it to!

Can anybody explain how to get the toolbar to the top of the form easily?

TIA

- Andy

Nov 15 '05 #3

Hi Andy,

The late added control's Dock property will based on the early added
control, so when you add the toolbar control, it will base on the splitter.
In the code behind, this late-early base way was defined by the order that
the control reference was added into the form's Controls collection.

To get what you want, you need just move the statement
"this.Controls.Add(this.toolBar1);" below all other controls' add
statement, then the toolbar's Dock will based on the form's edge.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| Subject: Adding ToolBar to an existing form...
| Date: Sat, 4 Oct 2003 10:53:38 +0100
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#E**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com 81.105.30.68
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:188934
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have hopefully a simple problem in C#.
|
| I designed a form with a listview on left, vert splitter against that,
then
| the remainder of the form from top to bottom: a listview, horiz splitter
and
| tab control (very similar to outlook express).
|
| I then started coding and realised that I needed to add a ToolBar. When I
| added this, it didn't appear at the top as expected, but at the top of the
| tab control and I couldn't get it to appear where I wanted it to!
|
| Can anybody explain how to get the toolbar to the top of the form easily?
|
| TIA
|
| - Andy
|
|
|
|

Nov 15 '05 #4

Hi Andy,

The late added control's Dock property will based on the early added
control, so when you add the toolbar control, it will base on the splitter.
In the code behind, this late-early base way was defined by the order that
the control reference was added into the form's Controls collection.

To get what you want, you need just move the statement
"this.Controls.Add(this.toolBar1);" below all other controls' add
statement, then the toolbar's Dock will based on the form's edge.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| Subject: Adding ToolBar to an existing form...
| Date: Sat, 4 Oct 2003 10:53:38 +0100
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#E**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com 81.105.30.68
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:188934
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have hopefully a simple problem in C#.
|
| I designed a form with a listview on left, vert splitter against that,
then
| the remainder of the form from top to bottom: a listview, horiz splitter
and
| tab control (very similar to outlook express).
|
| I then started coding and realised that I needed to add a ToolBar. When I
| added this, it didn't appear at the top as expected, but at the top of the
| tab control and I couldn't get it to appear where I wanted it to!
|
| Can anybody explain how to get the toolbar to the top of the form easily?
|
| TIA
|
| - Andy
|
|
|
|

Nov 15 '05 #5
Tom/Jeffrey -

Thanks both solutions seem to work.

Jeffrey - With regards to your suggestion, the fix is obviously applied to
the InitializeComponent method, which as I understood it was out of bounds
for changes, but it appears that this change has been retained; what changes
get kept and what get lost?!?

Regards

- Andy

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:u7**************@cpmsftngxa06.phx.gbl...

Hi Andy,

The late added control's Dock property will based on the early added
control, so when you add the toolbar control, it will base on the splitter. In the code behind, this late-early base way was defined by the order that
the control reference was added into the form's Controls collection.

To get what you want, you need just move the statement
"this.Controls.Add(this.toolBar1);" below all other controls' add
statement, then the toolbar's Dock will based on the form's edge.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| Subject: Adding ToolBar to an existing form...
| Date: Sat, 4 Oct 2003 10:53:38 +0100
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#E**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com 81.105.30.68
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:188934 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have hopefully a simple problem in C#.
|
| I designed a form with a listview on left, vert splitter against that,
then
| the remainder of the form from top to bottom: a listview, horiz splitter
and
| tab control (very similar to outlook express).
|
| I then started coding and realised that I needed to add a ToolBar. When I | added this, it didn't appear at the top as expected, but at the top of the | tab control and I couldn't get it to appear where I wanted it to!
|
| Can anybody explain how to get the toolbar to the top of the form easily? |
| TIA
|
| - Andy
|
|
|
|

Nov 15 '05 #6
Tom/Jeffrey -

Thanks both solutions seem to work.

Jeffrey - With regards to your suggestion, the fix is obviously applied to
the InitializeComponent method, which as I understood it was out of bounds
for changes, but it appears that this change has been retained; what changes
get kept and what get lost?!?

Regards

- Andy

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:u7**************@cpmsftngxa06.phx.gbl...

Hi Andy,

The late added control's Dock property will based on the early added
control, so when you add the toolbar control, it will base on the splitter. In the code behind, this late-early base way was defined by the order that
the control reference was added into the form's Controls collection.

To get what you want, you need just move the statement
"this.Controls.Add(this.toolBar1);" below all other controls' add
statement, then the toolbar's Dock will based on the form's edge.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| Subject: Adding ToolBar to an existing form...
| Date: Sat, 4 Oct 2003 10:53:38 +0100
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#E**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com 81.105.30.68
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:188934 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have hopefully a simple problem in C#.
|
| I designed a form with a listview on left, vert splitter against that,
then
| the remainder of the form from top to bottom: a listview, horiz splitter
and
| tab control (very similar to outlook express).
|
| I then started coding and realised that I needed to add a ToolBar. When I | added this, it didn't appear at the top as expected, but at the top of the | tab control and I couldn't get it to appear where I wanted it to!
|
| Can anybody explain how to get the toolbar to the top of the form easily? |
| TIA
|
| - Andy
|
|
|
|

Nov 15 '05 #7

Hi Andy,

I think your understanding of out of bounds to change must be the comment
of InitializeComponent method:
" Required method for Designer support - do not modify
the contents of this method with the code editor."

This comment means that Microsoft suggests that you do not modify this code
section, but any changes to it will still take effect.

InitializeComponent method is created by the VS.NET designer and it is
associated with(reflect) the designer, so Microsoft suggests that you
change your control in the designer not in the code.(It is more safe and
convient at most time.)

For your problem, you also can get it down in the designer, but I think it
is more convinent to change the order of 2 sentences.

Does this answer your question?
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| References: <#E**************@TK2MSFTNGP10.phx.gbl>
<u7**************@cpmsftngxa06.phx.gbl>
| Subject: Re: Adding ToolBar to an existing form...
| Date: Mon, 6 Oct 2003 06:40:55 +0100
| Lines: 79
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#E**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com 81.105.30.68
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:189147
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Tom/Jeffrey -
|
| Thanks both solutions seem to work.
|
| Jeffrey - With regards to your suggestion, the fix is obviously applied to
| the InitializeComponent method, which as I understood it was out of bounds
| for changes, but it appears that this change has been retained; what
changes
| get kept and what get lost?!?
|
| Regards
|
| - Andy
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:u7**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Andy,
| >
| > The late added control's Dock property will based on the early added
| > control, so when you add the toolbar control, it will base on the
| splitter.
| > In the code behind, this late-early base way was defined by the order
that
| > the control reference was added into the form's Controls collection.
| >
| > To get what you want, you need just move the statement
| > "this.Controls.Add(this.toolBar1);" below all other controls' add
| > statement, then the toolbar's Dock will based on the form's edge.
| >
| > Hope this helps,
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | From: "Andy Bates" <An********@UltimateSoftwareSolutions.com>
| > | Subject: Adding ToolBar to an existing form...
| > | Date: Sat, 4 Oct 2003 10:53:38 +0100
| > | Lines: 18
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#E**************@TK2MSFTNGP10.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: cpc3-farn1-6-0-cust68.glfd.cable.ntl.com
81.105.30.68
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:188934
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | I have hopefully a simple problem in C#.
| > |
| > | I designed a form with a listview on left, vert splitter against that,
| > then
| > | the remainder of the form from top to bottom: a listview, horiz
splitter
| > and
| > | tab control (very similar to outlook express).
| > |
| > | I then started coding and realised that I needed to add a ToolBar.
When
| I
| > | added this, it didn't appear at the top as expected, but at the top of
| the
| > | tab control and I couldn't get it to appear where I wanted it to!
| > |
| > | Can anybody explain how to get the toolbar to the top of the form
| easily?
| > |
| > | TIA
| > |
| > | - Andy
| > |
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Andy Bates | last post: by
2 posts views Thread by Steve McLellan | last post: by
1 post views Thread by Wrauberto | last post: by
1 post views Thread by Bill Nguyen | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.