473,749 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a control to a tab page

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

tabMain.TabPage s[0].Controls.Add(a Label);

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

Any ideas???
Nov 15 '05 #1
5 1807
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*******@disc ussions.microso ft.com> wrote in message
news:4d******** *************** *****@phx.gbl.. .
I am trying to add a label to a tab page

tabMain.TabPage s[0].Controls.Add(a Label);

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*******@disc ussions.microso ft.com> wrote in messagenews:4d******* *************** ******@phx.gbl. ..
I am trying to add a label to a tab page

tabMain.TabPage s[0].Controls.Add(a Label);

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.tabCustome rs.TabPages[0].Controls.Add(n ew 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.WriteLi ne(tabControl1. TabPages.Count) ;
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Liz" <an*******@disc ussions.microso ft.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*******@disc ussions.microso ft.com> wrote in

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

tabMain.TabPage s[0].Controls.Add(a Label);

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.Ta bPages[0].Controls.Add(a Label);
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.tabCustom ers.TabPages[0].Controls.Add(n ew 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
5482
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 dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
3
4882
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 the best method? Do you have a sample of how to do this?
5
1691
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 of code blocks (<% %>) on the page. Most of these blocks can be handled by adding a label control to the form so it is not that big of deal, but one of the things being posted is the page title. I am not sure how I can access that from the code...
3
1637
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 derive all my pages from a common base class, and that I could add this link to each page's <HEAD> tag from the C# base class. Is this possible? Is there an alternate way of adding this link to each page? many thanks
3
5169
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" The user control has this button on its page. I am outputing the <form runat="server"> inside the render method and have also tried adding it to the page and to the control without any luck. Any help appreciated.
3
2343
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 page. So whenever the Admin person comes to know about the new category in the market he will be adding as different Sub-Categories for example ABAP, BDC etc..etc.. on every click event as Checkboxes. And these controls(checkboxes) should remain...
4
1670
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 a token example <pthis is a test <textbox /and a text box should be entered </P> the tool should render the message and instead of <textbox /it should
3
5493
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 following error when the DDL is added (but not the Label): "Control 'ctl07' of type 'DropDownList' must be placed inside a form tag
2
1881
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 server-side Form tag" error. Here is the brief code that I am adding to the code: on top: <%@ Register TagPrefix="uc" TagName="CareerStats" Src="/Controls/CareerStats.ascx" %> and the div where I added the control:
2
15071
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 been able to find the cause of the problem, and will describe it here first textually and then through a code example. The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.