473,320 Members | 1,950 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.

TabControl and Sharing Controls on pages


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
As System.EventArgs) Handles TabControl1.TabIndexChanged
Dim i As New TabControl.TabPageCollection(Me.TabControl1)
Dim COUNT As Integer
Dim J As Integer
J = TabControl1.SelectedIndex
For COUNT = 0 To i.Count - 1
If
TabControl1.TabPages(COUNT).Controls.Contains(Me.G roupBox1) Then
TabControl1.TabPages(COUNT).Controls.Remove(Me.Gro upBox1)
End If
Next
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

'do I need to add the location and sizes again as well as it member
controls?
End Sub

Nov 21 '05 #1
5 3706
put
Me.GroupBox1.visible = True
after
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

"scorpion53061" wrote:

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
As System.EventArgs) Handles TabControl1.TabIndexChanged
Dim i As New TabControl.TabPageCollection(Me.TabControl1)
Dim COUNT As Integer
Dim J As Integer
J = TabControl1.SelectedIndex
For COUNT = 0 To i.Count - 1
If
TabControl1.TabPages(COUNT).Controls.Contains(Me.G roupBox1) Then
TabControl1.TabPages(COUNT).Controls.Remove(Me.Gro upBox1)
End If
Next
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

'do I need to add the location and sizes again as well as it member
controls?
End Sub

Nov 21 '05 #2
No that did not work.

I was using the wrong event....

Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Dim i As New TabControl.TabPageCollection(Me.TabControl1)

Dim COUNT As Integer
Dim J As Integer
J = TabControl1.SelectedIndex

For COUNT = 0 To i.Count - 1
If TabControl1.TabPages(COUNT).Controls.Contains(Grou pBox1)
Then
TabControl1.TabPages(COUNT).Controls.Remove(GroupB ox1)
End If
Next
TabControl1.TabPages(J).Controls.Add(GroupBox1)
End Sub

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:Ru*******@discussions.microsoft.com:
put
Me.GroupBox1.visible = True
after
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

"scorpion53061" wrote:

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

As System.EventArgs) Handles TabControl1.TabIndexChanged
Dim i As New TabControl.TabPageCollection(Me.TabControl1)
Dim COUNT As Integer
Dim J As Integer
J = TabControl1.SelectedIndex
For COUNT = 0 To i.Count - 1
If
TabControl1.TabPages(COUNT).Controls.Contains(Me.G roupBox1) Then

TabControl1.TabPages(COUNT).Controls.Remove(Me.Gro upBox1)
End If
Next
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

'do I need to add the location and sizes again as well as it member
controls?
End Sub


Nov 21 '05 #3
"scorpion53061" <sc************@nospamhereyahoo.com> schrieb:
I am trying to be able to share a groupbox and its related controls among
all of my tab pages.


Place the groupbox outside a tabpage and then move it over the tabcontrol.
Maybe you'll have to choose "Bring to front" to show the groupbox in front
of the tabcontrol.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
Thats very complicated. A Control can only be in one place at any one time
so theres no need to remove it from the tabpage its on.
You don't need to search the tabpages to find a control that you know the
name of.

\\\
Sub TabControl1_SelectedIndexChanged(...)...
TabControl1.SelectedTab.Controls.Add(GroupBox1)
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"scorpion53061" <sc************@nospamhereyahoo.com> wrote in message
news:ec****************@TK2MSFTNGP11.phx.gbl...
No that did not work.

I was using the wrong event....

Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Dim i As New TabControl.TabPageCollection(Me.TabControl1)

Dim COUNT As Integer
Dim J As Integer
J = TabControl1.SelectedIndex

For COUNT = 0 To i.Count - 1
If TabControl1.TabPages(COUNT).Controls.Contains(Grou pBox1)
Then
TabControl1.TabPages(COUNT).Controls.Remove(GroupB ox1)
End If
Next
TabControl1.TabPages(J).Controls.Add(GroupBox1)
End Sub

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:Ru*******@discussions.microsoft.com:
put
Me.GroupBox1.visible = True
after
TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)

"scorpion53061" wrote:
>
> 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
>
> As System.EventArgs) Handles TabControl1.TabIndexChanged
> Dim i As New TabControl.TabPageCollection(Me.TabControl1)
> Dim COUNT As Integer
> Dim J As Integer
> J = TabControl1.SelectedIndex
> For COUNT = 0 To i.Count - 1
> If
> TabControl1.TabPages(COUNT).Controls.Contains(Me.G roupBox1) Then
>
>
> TabControl1.TabPages(COUNT).Controls.Remove(Me.Gro upBox1)
> End If
> Next
> TabControl1.TabPages(J).Controls.Add(Me.GroupBox1)
>
> 'do I need to add the location and sizes again as well as it member
> controls?
> End Sub
>
>

Nov 21 '05 #5
Found the issue. You should use TabControl.SelectedIndexChanged event.

Nov 21 '05 #6

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

Similar topics

5
by: meh | last post by:
New to C#... I have a tab page with a handful of controls on it (label, combobox, etc.). Is it possible to "boilerplate a tabPage with the controls "like a MDI childForm" so that adding a new...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
8
by: Aaron Ackerman | last post by:
If I am expanding (maximizing a form how do I maximize the tab control along with it?
3
by: VJ | last post by:
I need to have a Tab Control with 4 tab pages. Each tab pages should have a certain list and list view controls. What these list view controls show depend on the tabpage. Do I have to create the...
0
by: Juan Pedro Gonzalez | last post by:
Hi, I'm running mad with this issue, hope I can explain it correctlly. I've been developping a user control wich is very similar to the TabControl... Basically my control has two panels that...
2
by: Paul Bromley | last post by:
I am using a tabcontrol alled for example:- TabPage There are several tabs on this tabcontrol with command buttons on them. I want to loop through them but the following code does not work:- ...
0
by: qinger | last post by:
Hello, I am trying to organize the controls on a TabControl. The tabcontrol is sitting on a dialog with OK and Cancel buttons. So I created 2 TableLaoutPanels -- one for TabControl and one for...
2
by: Gav | last post by:
I am writing an application where I will have a TabControl and 3 styles of Tabs to go in it, each containing different controls. The tabs will be added to the tabcontrol when items are clicked on...
2
by: Claudia Fong | last post by:
Hi, I added a tabcontrol in a panel in my form. My tabcontrol have more than 3 pages.. each page contains textboxes, combobox, checkbox. I want to disable the items of each of the page of...
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...
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)...
1
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.