Tab Control as a argument

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    #1

    Tab Control as a argument

    How would i pass the TabControl to a function?

    I have a function:
    [code=vb]
    Public Function processCount(ct rlName As TabControl) As Integer
    ....
    [/code]

    Call :
    Code:
    processCount( 'I want to pass the Tab Control Name i am interested in')
    I cant pass it as a String - i get type mismatch error obviously.

    I have also tried:
    Code:
    processCount( TabCt1.Name = [Page 2])
    But then i get compile error within the function :
    "Method or data member not found"

    when i do this
    Code:
    For Each Ctrl In pageName.Controls


    Help please?
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Questionit, you've once again posted a question on the Access Articles section! I'll move it over to the Access Forum for you, but please be more careful in the future. Aside from the fact that you're making extra work for the moderators, posting a question to the Articles section means that it's not being seen by most of the members and hence decreasing the chance that you'll get a timely response.

    Linq ;0)>

    Comment

    • JKing
      Recognized Expert Top Contributor
      • Jun 2007
      • 1206

      #3
      TabControl and Page are two different things. You're currently trying to pass a page in as a TabControl.

      So you can either pass in a tab control to your current function and manipulate the pages through the page index property of the tab control. Your tab control is probably called something like Me.TabCtl0 on your form.

      So that would be something like:
      [code=vb]
      Dim intx as Integer

      intx = processCount(Me .TabCtl0)
      [/code]

      Or you can change the Function to take in a page instead of a tabcontrol

      [code=vb]
      Public Function processCount(ct rl as Page) As Integer
      End Function

      'call it
      intx = processCount(Me .Page2)
      [/code]

      Comment

      Working...