473,671 Members | 2,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Forms Advice - same controls on different Tabpages

Dear Windows Form Designers

I am developing an application that uses a TabControl with several
Tabpages.

On the different Tabpages I wish to allow users to have the access to
the
same controls for instance a textbox to enter a date and time string
for search.

Firstly is there anyway to display the same textbox on four Tabpages
or do
I need to have four date and time fields? How do you keep the date
and time
textboxes the same across the four Tabpages.

Secondly if you have a combobox that a user selects an account number
from,
how can you adjust each other Tabpage so that the use does not need to
reselect
the account number if they change between Tabpages?

Thanks

David

May 11 '07 #1
7 5571
On May 11, 2:37 pm, davidpryce...@y ahoo.com.au wrote:
Dear Windows Form Designers

I am developing an application that uses a TabControl with several
Tabpages.

On the different Tabpages I wish to allow users to have the access to
the
same controls for instance a textbox to enter a date and time string
for search.

Firstly is there anyway to display the same textbox on four Tabpages
or do
I need to have four date and time fields? How do you keep the date
and time
textboxes the same across the four Tabpages.

Secondly if you have a combobox that a user selects an account number
from,
how can you adjust each other Tabpage so that the use does not need to
reselect
the account number if they change between Tabpages?

Thanks

David
Dear David.
You can set the Container property of the textbox each time the tab
page selection changes like this: textBox1.Contai ner = tabPage1;

On any container change, make sure the layout is proper for your
needs.

Can you be more specific on the second question?

Hope this helps.

Cheers,
Moty.

May 11 '07 #2
For the combobox, try making it a child of the form rather than a child of
each tab page. Position it so that it is on top of the tab pages, and of
course make sure that it is on top of the z-order. This way it will appear
to be on each tab, but there will really only be one, and you won't have
several between which to keep values synchronized.

--
Brian Schwartz
FishNet Components
http://www.fishnetcomponents.com
Fish Grid .NET Light: Powerful Layouts for Small Datasets
<da***********@ yahoo.com.auwro te in message
news:11******** **************@ u30g2000hsc.goo glegroups.com.. .
Dear Windows Form Designers

I am developing an application that uses a TabControl with several
Tabpages.

On the different Tabpages I wish to allow users to have the access to
the
same controls for instance a textbox to enter a date and time string
for search.

Firstly is there anyway to display the same textbox on four Tabpages
or do
I need to have four date and time fields? How do you keep the date
and time
textboxes the same across the four Tabpages.

Secondly if you have a combobox that a user selects an account number
from,
how can you adjust each other Tabpage so that the use does not need to
reselect
the account number if they change between Tabpages?

Thanks

David

May 12 '07 #3
Hi Moty,

I have tried setting the textBox1.Contai ner = tabPage1.

However, I am getting the complie error that

textBox1.Contai ner = tabPage1;

Property or indexer 'System.Compone ntModel.Compone nt.Container' cannot
be assigned to -- it is read only.

Am I missing something there?

Thanks

David
May 13 '07 #4
Here is the actual code I tried.

private void tabControl1_Sel ecting(object sender,
TabControlCance lEventArgs e)
{
TabControl senderTabContro l = (TabControl)sen der;
if (senderTabContr ol.SelectedTab == tabPage1)
{
MessageBox.Show ("tabpage 1");
this.textBox1.C ontainer = textBox1;
}
else
{
MessageBox.Show ("tabpage 2");
}
}

May 13 '07 #5
On May 13, 10:35 am, davidpryce...@y ahoo.com.au wrote:
Here is the actual code I tried.

private void tabControl1_Sel ecting(object sender,
TabControlCance lEventArgs e)
{
TabControl senderTabContro l = (TabControl)sen der;
if (senderTabContr ol.SelectedTab == tabPage1)
{
MessageBox.Show ("tabpage 1");
this.textBox1.C ontainer = textBox1;
}
else
{
MessageBox.Show ("tabpage 2");
}
}
Hi David,

this code will do the work (inside the SelectedIndexCh anged event of
the TabControl control):

if (sender is TabControl)
{
TabControl tc = (TabControl)sen der;
tc.SelectedTab. Controls.Add(te xtBox1);
}

The second line of the if statment will make sure the text box is
assigned to one ControlCollecti on.

Quote: "A Control can only be assigned to one
Control.Control Collection at a time. If the Control is already a child
of another control it is removed from that control before it is added
to another control."

Sorry for misleading you with the Container propety.

Have a great week,
Moty
May 13 '07 #6
Moty,

Perfect. Thanks. Exactly what I wanted.

David

May 13 '07 #7
On May 13, 11:12 am, davidpryce...@y ahoo.com.au wrote:
Moty,

Perfect. Thanks. Exactly what I wanted.

David
Great! :)

May 13 '07 #8

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

Similar topics

8
1651
by: Bf | last post by:
I was creating test projects using c# and was surprised that there seems to be only a form based windows applications available. Is it safe to assume that classic window applications that utilize a parent window with child windows can only be done in c++ and mfc and there's nothing else in .net that is meant to be used like that? It seems to be that c# should be used for either form based windows apps, console apps, and web apps (also...
1
1209
by: William Sullivan | last post by:
I've spent plenty of time building windows forms, but I'm working on a web project now. I've scanned a few ASP NET books, checked out some tutorials, but I am unable to figure out how to lay out complex groups of controls that need to interact with each other on a web page properly. My main page's design includes a number of different controls. On the left I have three groups of controls: A textbox with a button for searching (the...
6
2326
by: | last post by:
Just a general question... When working with a form containing a treeview or similar control... if you need to show different form fields depending on what is selected in the treeview then what is the best way to deal with these form controls...? Like, when they are all visible in the designer it can be absolute chaos... So how do you guys deal with it? Is there a blank container control (can't see one) that allows you to drop a...
1
2727
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first tabpage (that I create at design time) is the "template" to be used for the other tabpages. Is...
5
3724
by: scorpion53061 | last post by:
I am trying to be able to share a groupbox and its related controls among all of my tab pages. This does not error but the controls do not appear either. Thank you for your help!! Private Sub TabControl1_TabIndexChanged(ByVal sender As Object, ByVal e
0
995
by: Carlao | last post by:
I am using Windows Forms with vb.net. My app is a MDI and I have some child forms. My problem is when I try to use Control+Tab. If I have a TabControl control with some tabpages in the main form (container) then if TabControl has the focus, using Control+Tab I can switch from one tabpage to another. If I open a child form that has another TabControl and I try to use Control+Tab to navigate between tabpages it does not work. The reason is...
0
1958
by: bosco | last post by:
Hey, I'm using a TabControl in my app, and at the moment I have 5 TabPages. Each tab page will have the exact same controls but will constitute an instance of a custom object I have created. What I'm looking for is any possible way of iteratively assigning the variables from the tab page controls to an instance of my object, ultimately creating an ArrayList of my objects containing the 5 objects derived from my 5 tabpages. I'm...
3
4681
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The form that has the System.Windows.Forms.LinkLabel controls on it is in a different project and under a different namespace from the file where the LinkLabel_LinkClicked events are, so I can't just do frm.ShowDialog under the LinkClicked method. ...
21
3340
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. Normally this can accomplished using a modal form, however this prevents me from opening a new copy of...
0
8476
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
8917
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...
1
8598
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
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6229
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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.