473,397 Members | 2,056 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,397 software developers and data experts.

Why is label not showing up in my tab?

When I create the tab for the tab control and try to add the label to it, the label will not show. What am I doing wrong here?

Expand|Select|Wrap|Line Numbers
  1. private void FirstLogin()
  2.         {
  3.             TabPage loginTab = new TabPage("Login");
  4.             loginTab.BackColor = SystemColors.Control;
  5.  
  6.             tabControl1.TabPages.Add(loginTab);
  7.  
  8.             Label loginLabel = new Label();
  9.  
  10.             loginLabel.Size = new System.Drawing.Size(25, 25);
  11.             loginLabel.Location = new System.Drawing.Point(500,500);
  12.             loginLabel.Text = "Test text!";
  13.  
  14.             this.Controls.Add(loginLabel);
  15.         }
Jan 25 '11 #1
1 2494
I believe you need to change:

this.Controls.Add(loginLabel);

to

loginTab.Controls.Add(loginLabel);

Otherwise, you are adding the label to the main control (probably the form) instead of the tab page.
Jan 25 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
5
by: WindAndWaves | last post by:
Hi Gurus I have a very simple question this time. I have a continuous form with a textbox (ID number) and a label. The label has a on_click event: msgbox me.id.value If I click on the...
1
by: Henry | last post by:
I was trying to work through the Lab 2 exercises in the Microsoft's Windows-Based Applications in Visual C#. While I am not showing any errors I am also not seeing the mainMenu object when I run...
3
by: Brenny | last post by:
Hello I'm designing a windows form and form's background image is exist and I added a label and groupbox. There is a spesific image on the form and I want to show this image as label and...
9
by: Justin | last post by:
I am trying to figure out how to display the sum total of a numeric column in the footer of a datagrid. I have tried putting a label control in the footer of a column but for some reason when I try...
0
by: Mohan | last post by:
I want to clear a label when validation error messages are displayed. The users enter multple records into the system. If they make a mistake in the 2nd entry, the validation kicks in, and the...
11
by: Peter Larsen [] | last post by:
Hi, I have two questions related to the Label control. How do i prevent the label from expand the canvas into 2 lines (word wrap) ?? At the moment i set AutoSize to false (to prevent the word...
0
by: tweakmy | last post by:
Hi to all expert, ladies coders and gentlemen coders, I m quite newbie in this. I just started vb.net not long ago..because i was too crazy bout making an application for my own phone. as for now, i...
1
by: Mamba | last post by:
I am doing some changes on an old app that uses several tab pages in a window. TabPageA has a labelA that reads "blah blah blah" When the user clicks a control to display TabPageB, TabPageA...
4
by: rb0135 | last post by:
Hi, I am writing a C# mobile 6 (dot.net 3.5) application. On the form, I have a label. I update this label with text as my initalizing routines are running (from the form load event), such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...

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.