TabControl

  • Thread starter Thread starter VJ
  • Start date Start date
V

VJ

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 control in each tabpage?
Also, I will be allowing the application user to add thier own tab pages,
which will carry same list and listview, but again what it shows depends on
what tabpage they have added. How do I accomplish this without having to add
the controls in each tabpage.

Sorry if this is very simple one.. tho I have programmed quite a bit, I have
never used tabcontrols that extenisvely.

VJ
 
I created a form, added a TabControl to it, then Added 2 tabpages. I added
a TextBox to TabPage1, and it belongs to TabPage1 only. Now, to add tabs at
runtime, try this:

Dim tp As TabPage = New TabPage("Boo")
tp.TabIndex = Me.TabControl1.TabCount
Dim tb As TextBox = New TextBox()
tb.Location = New Point(0, 0)
tb.Size = New Size(25, 8)
tp.Controls.AddRange(New Control() {tb})
Me.TabControl1.TabPages.Add(tp)

HTH,
JLW
 
* "VJ said:
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 control in each tabpage?
Also, I will be allowing the application user to add thier own tab pages,
which will carry same list and listview, but again what it shows depends on
what tabpage they have added. How do I accomplish this without having to add
the controls in each tabpage.

Should there be one instance of the control that is shared between the
tabs or should each tab has its own instance?
 
The tabs can share a instance of a control. What the controls shows, i.e
listbox contents will change per tab. Can I achieve this by sharing a
instance of control across tabs.. My familiarity with OOP says I could ..
but I am a novice in tabcontrol.. so just checking..

VJ
 
Back
Top