TabControl

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
 
J

JLW

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
 
H

Herfried K. Wagner [MVP]

* "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?
 
V

VJ

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top