473,241 Members | 1,780 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,241 software developers and data experts.

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

Similar topics

1
by: Tony D. | last post by:
I could really use some help with a problem I am having. I am trying to add a new field to an existing form that combines two tables into one form. In this same databse I have another form that...
0
by: Andy Bates | last post by:
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...
2
by: Steve McLellan | last post by:
Hi, Can anyone tell me how I can add an existing (managed) form into a project, and have it appear like others (i.e. able to open in the designer)? Thanks! Steve
1
by: Wrauberto | last post by:
Howdy, I have an existing form loaded with all sorts of pretty boxes and buttons. I want to make this an MDI child and need to create an MDI parent OR make this a parent and launch children from...
1
by: Bill Nguyen | last post by:
I need to copy the existing form EDIT1 to EDIT2 into the same project so that I can modify EDIT2 while preserving EDIT1 for a slightly different use. What's an easy way to do it? Thanks Bill
3
by: Byron Hopp | last post by:
Anybody have code to add a ToolBar, and its buttons to a MDI Child window. I have added the Toolbar, and added the buttons, but how do you determine what the button is going to execute upon the...
1
by: ECathell | last post by:
I am getting an unspecified error when adding a windows form to a project. New project, old project. Doesn't matter. Also happens for user control. All the message box says is Unspecified Error. ...
7
by: ewarts | last post by:
Hello all, I'm having an issue adding more combo box to an existing form, please correct me if I'm wrong in my method but i'm copying the combo box above and pasting it below so to have the same...
2
by: mhnaccess | last post by:
I am trying to create controls, EG a text box, at runtime. ALL examples I find are creating a new form at the same time. I want to create a control on an existing form. The following does not...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...

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.