?
Solved

VB.NET Custom TabControl / TabPage

Posted on 2003-11-24
6
Medium Priority
?
3,560 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
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
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

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