473,320 Members | 2,092 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 a control to a tab page

Liz
I am trying to add a label to a tab page

tabMain.TabPages[0].Controls.Add(aLabel);

and get an error "specified argument was out of the range
of valid values.

Any ideas???
Nov 15 '05 #1
5 1788
Hi Liz,

Are you sure that there is TabPages[0]?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Liz" <an*******@discussions.microsoft.com> wrote in message
news:4d****************************@phx.gbl...
I am trying to add a label to a tab page

tabMain.TabPages[0].Controls.Add(aLabel);

and get an error "specified argument was out of the range
of valid values.

Any ideas???

Nov 15 '05 #2
Liz
Yes - I actually have two tab pages - I've also tried
TabPages[1] - which gives the same error.

-----Original Message-----
Hi Liz,

Are you sure that there is TabPages[0]?

--
Miha Markic - RightHand .NET consulting & software developmentmiha at rthand com
www.rthand.com

"Liz" <an*******@discussions.microsoft.com> wrote in messagenews:4d****************************@phx.gbl...
I am trying to add a label to a tab page

tabMain.TabPages[0].Controls.Add(aLabel);

and get an error "specified argument was out of the range of valid values.

Any ideas???

.

Nov 15 '05 #3
Jax
There must be something wrong with your tab pages
I just did
this.tabCustomers.TabPages[0].Controls.Add(new TextBox())
On one of my old applications and it worked perfectly. The tabControl (tabCustomers) was built through the designer
Have you gone through debugger to check the pages are actually in the tab when you reference them?
Nov 15 '05 #4
I get the same error when I access the page that doesn't exist.
Try this:
Console.WriteLine(tabControl1.TabPages.Count);
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Liz" <an*******@discussions.microsoft.com> wrote in message
news:4a****************************@phx.gbl...
Yes - I actually have two tab pages - I've also tried
TabPages[1] - which gives the same error.

-----Original Message-----
Hi Liz,

Are you sure that there is TabPages[0]?

--
Miha Markic - RightHand .NET consulting & software

development
miha at rthand com
www.rthand.com

"Liz" <an*******@discussions.microsoft.com> wrote in

message
news:4d****************************@phx.gbl...
I am trying to add a label to a tab page

tabMain.TabPages[0].Controls.Add(aLabel);

and get an error "specified argument was out of the range of valid values.

Any ideas???

.

Nov 15 '05 #5
Liz
I just tried it again with this. infront, ie
this.tabMain.TabPages[0].Controls.Add(aLabel);
and it worked!!!! Don't know why?? Thanks for your help
-----Original Message-----
There must be something wrong with your tab pages.
I just did:
this.tabCustomers.TabPages[0].Controls.Add(new TextBox());
On one of my old applications and it worked perfectly. The tabControl (tabCustomers) was built through the
designer.Have you gone through debugger to check the pages are actually in the tab when you reference them?.

Nov 15 '05 #6

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
5
by: Jeremy Ames | last post by:
I have run into a major road block with my page development projects. I am trying to add a literal control to my asp.net page and I got an error stating that the control could not be added because...
3
by: Ron James | last post by:
I would like to add a CSS link to every page on my site - "<LINK href="BLT.css" type="text/css" rel="stylesheet">". This links needs to go in the <HEAD> of my page. I was hoping that I could...
3
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" ...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
4
by: Duncan Dimech | last post by:
Dear All I am writing a tool which requires to have controls added to it dynamically. To make the task more complex, the addition of the control cannot happen anywhere but it has to be instead of...
3
by: Mark Denardo | last post by:
I'm trying to dynamically create and add controls to a web page: Label obj1 = new Label(); DropDownList obj2 = new DropDownList(); Controls.Add(obj1); Controls.Add(obj2); But I get the...
2
by: AlecL | last post by:
I have a page that has about 5 or 6 user controls ranging from hearders to footers to ad space but when I add a new user control which is a form it gives me the exception "page can have only one...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: 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...
0
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....

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.