473,320 Members | 1,933 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,320 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 2322
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: 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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
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...

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.