Solved

VB.NET Custom TabControl / TabPage

Posted on 2003-11-24
6
3,391 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

838 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