Tab Control _click Doesn't

Ok I give... The tabcontrol_click event. As I read the 'help' file

If there is at least one TabPage in the collection, and the user interacts with the tab control's header (where the TabPage names appear), the TabControl raises the appropriate event. However, if the user interaction is within the ClientRectangle of the tab page, the TabPage raises the appropriate event.

Just how does one get the tabcontrol to raise it's events

Clicking the clientrectangle will raise the event 'TabODTurn_Click' 'myname for this control'.. but clicking on any of the 'Tabs' does not raise any events..... I do have three tabpages in the tab control at present. I would like to inbed more tab controls in the client area of the 'top' control but first things first.

I am new to this .net way of programming... Stayed with VB6 as long as I could... Still not sure I want to learn this new stuff, but I do want to keep working... :)

TIA

stubs



Answer this question

Tab Control _click Doesn't

  • joe everett

    hi,

    there are a difference between tabcontrol and tabpage when you select the pages you can notice that , this control draw black thin rectangle outside of the selected the control , when you select tabpage the rectangle is a little bit smaller than the tab control i know it can cheat your eyes as it did to me b4

    select tab page or tabcontrol but be sure which one is this and go to properties you will find icon like flash at top click it , it will open to you all the events that this control can use and the name of the selected item in the combobox at top

    or you can handle that by code like the following



    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    'tabpages raised events click or mouse click
    AddHandler tabPage1.MouseClick, AddressOf Me.tabPage1_MouseClick
    AddHandler tabPage2.Click, AddressOf Me.tabPage2_Click
    'tabcontrol raise click event
    AddHandler tabControl1.MouseClick, AddressOf Me.tabControl1_MouseClick
    End Sub

    Private Sub
    tabPage1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    MessageBox.Show(
    "you have clicked tabpage1")
    End Sub

    Private Sub
    tabPage2_Click(ByVal sender As Object, ByVal e As EventArgs)
    MessageBox.Show(
    "you have clicked tabpage2")
    End Sub

    Private Sub
    tabControl1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    MessageBox.Show((
    "tabcontrol1 to select page " + tabControl1.SelectedTab.Name))
    End Sub


    hope this helps



  • Srik Raghavan

    Thanks for the responds but that was not what I was looking for.. The tab control will generate this event if the user clicks on the client area but NOT the tab section of the control ..

    I finally found the event I needed... It is the Selecting and the Selected events of the Tab Control.

    This seems to be one of my sticking points using the new VB THE HELP FILES DONT!!! HELP that much. I must have read and reread the same dozen pages before I decyfered the correct section. Must be getting older than I thought. Either that or have had my head buried to deep the machine control programming to long...

    stubs..


  • Tab Control _click Doesn't