Creating my own Tabcontrol-like control in VB.Net

  • Thread starter Thread starter André Nogueira
  • Start date Start date
A

André Nogueira

Hi there.
First of all, sorry for the double post, but I was not sure about which was
the most correct group for this question...
I am trying to create my own control that will be alot like the control
Outlook 2003 has where you can choose "mail", "Calendar", etc.
However, I've got two questions.
1) If you add a tab control, you can choose which tab you want to add
controls to in the development environment. How can I add this functionality
to my own control?
2) Each tab page has its own panel, and you can add controls to it at design
time. How can I archieve this with my own control?

Thank you for your time!

André Nogueira
 
André Nogueira said:
I am trying to create my own control that will be alot like the control
Outlook 2003 has where you can choose "mail", "Calendar", etc.
However, I've got two questions.
1) If you add a tab control, you can choose which tab you want to add
controls to in the development environment. How can I add this
functionality to my own control?
2) Each tab page has its own panel, and you can add controls to it at
design time. How can I archieve this with my own control?

Hi André,

I know that this is not an answer to your question but I have made the
experience that buying such a control is cheaper than doing it oneself from
scratch.

Here are two links to commercial controls:

http://www.devcomponents.com/dotnetbar/
http://www.windowsforms.net/ControlGallery/ControlDetail.aspx?Control=328&tabindex=0
http://www.infragistics.com/products/lookandfeel.asp

Cheers

Arne Janning
 
Yeah, I know. But I have lots of free time and am doing this just for the
fun of it, until I go to college in October.
I already made, for instance, Office 2003-style menus though there are many
around.
It's just a way of learning new things and experimenting.
If I were doing a commercial program, I'd definately buy the controls as
oposed to writing my bug-filled ones from scratch ;)
Thank you for your suggestion though!

Andre Nogueira
 
* "André Nogueira said:
I am trying to create my own control that will be alot like the control
Outlook 2003 has where you can choose "mail", "Calendar", etc.
However, I've got two questions.
1) If you add a tab control, you can choose which tab you want to add
controls to in the development environment. How can I add this functionality
to my own control?
2) Each tab page has its own panel, and you can add controls to it at design
time. How can I archieve this with my own control?

Take a look at the implementation of the explorer bar's design-time
support in the Visual Basic PowerPack:

<URL:http://www.gotdotnet.com/Community/Workspaces/workspace.aspx?id=167542e0-e435-4585-ae4f-c111fe60ed58>
 
Hi Andrè,

If you are not a commercial programmer I totally agree with you: there is no
better way of learning Windows.Forms than developing one's own controls.

Unfortunately, AFAIK there are no free implementations or at least how-to's
that describe how to implement a Outlook 2003-style Tabbar.

So you'll have to do everything on your own... (The learning effect might
even be bigger :-)

Cheers

Arne Janning
 
Yeah, I know I have to do it all by myself.
The only questions I have are the ones I posted on my first post.
I found some code about the expanding control panels coded in VB.net that
mimic the controls found in Windows XP's Windows Explorer.
I'll look at them and take it from there.

Cheers

Andre Nogueira
 
If you mean how to add controls to a newly opened tab then open a new project and add a tab control and remove all the tabs and add two buttons and change their name in the properties bar to "addtabbutton" and "deletetabbutton" then look at this example code:

Public Class Form1
Dim int As Integer = 0, numFavourites = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
Private Sub AddTabButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabButton.Click
Dim Text As New TextBox
TabControl1.TabPages.Add("New Tab")
TabControl1.SelectTab(int)
Text.Name = "Sample by Joshwd36"
Text.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Text)
int = int + 1
End Sub

Private Sub DeleteTabButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteTabButton.Click
If Not TabControl1.TabPages.Count = 1 Then
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
int = int - 1
End If
End Sub
End Class

This is in vb 2010
 
Back
Top