Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tabs etc (XP 2003)

    Two questions.

    1. In a tab control, we have the tab container and any number of pages. What I need is the syntax to reference a page of a tab control when you click on the actual page heading. For example. if we have two pages on a tab control, one captioned "one" and the other "two" (imaginative I know), I want to be able to reference the click event on the actual tab, not the page. The click event of the page does not interest me, it the click event on the container that references the page that does.

    2. I am thinking of creating for myself a tool that creates automatic code generation (I use data access classes a lot of the time and am getting sick of the hack work of creating the properties of each field in the respective table). What I want to know is how does one write to a new class module by code?

    Cheers

    Robin

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Tabs etc (XP 2003)

    1. Use the On Change event of the tab control as a whole instead of events for each individual tab page. The Value property of the tab control is the zero-based index of the tab page that is activated. So for a tab control named tabSomething, you can use code like this:

    Private Sub tabSomething_Change()
    Select Case Me.tabSomething.Value
    Case 0
    ' user clicked first tab
    Case 1
    ' user clicked second tab
    ...
    End Select
    End Sub

    2. If you set a reference to the Microsoft Visual Basic for Applications Extensibility 5.3 library in Tools | References..., you'll be able to manipulate code in code. Unfortunately, the online help assumes that you already know how it works. Some examples can be found in Programming To The VBE on Chip Pearson's site.

  3. #3
    New Lounger
    Join Date
    Feb 2005
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tabs etc (XP 2003)

    Brilliant Hans. Thanks mate, just what I was looking for.

    Robin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •