Solved

VB.NET Custom TabControl / TabPage

Posted on 2003-11-24
6
3,404 Views
Last Modified: 2008-01-16
I have created my own TabPage (inherited from Windows.Forms.TabPage) and I am now attemping to create my own TabControl (inherited from Windows.Forms.TabControl) so that I can use the verbs to add and remove my own tab pages from the tabcontrol.

I sort of go the verb part working ok, however, in the designer, when I have more than 1 tab it does not allow me to click on the additional tabs.

What am I doing wrong? I believe I am missing something from my designer class because if I remove my custom designer, i can now click on the additional tabs.

Thanks
0
Comment
Question by:liebrand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9813440
Are you overriding any of the normal behavior of the control?
0
 
LVL 15

Author Comment

by:liebrand
ID: 9813458
nope... do the following:

<Designer("MyTabControlDesigner")> _
Public Class MyTabControl
   inherits system.windows.forms.tabcontrol

end Class

Public Class MyTabControlDesigner
    inherits System.Windows.Forms.Design.ControlDesigner

End Class

And you will see that if you add tabs, you cannot select them.
0
 
LVL 15

Author Comment

by:liebrand
ID: 9814773
I figured it out ... i landed up doing the following in my designer:

        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            Dim p As System.Drawing.Point
            Dim n As TickerTabPage

            If m.Msg = WM_LBUTTONDOWN Then
                p = New System.Drawing.Point(m.LParam.ToInt32())

                For index As Integer = 0 To _Control.TabPages.Count - 1
                    Dim tabRec As System.Drawing.Rectangle = _Control.GetTabRect(index)
                    If (tabRec.Contains(p)) Then
                        _Control.SelectedIndex = index
                    End If
                Next
            End If
            MyBase.WndProc(m)
        End Sub
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 9815384
Question closed and points refunded

PashaMod
CS Moderator
0
 

Expert Comment

by:Bharat Guru
ID: 9818806
i syour tab will work in Netscape
0
 

Expert Comment

by:brookd
ID: 22254648
Can you access a tab by name/ID,  not by the integer index?
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MailAddress in vb 4 36
Selenium: Transitioning from unit testing to automated testing 4 61
Data organization issue 7 37
C# XML Get Values 4 35
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question