By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,903 Members | 1,856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,903 IT Pros & Developers. It's quick & easy.

Tab Control as a argument

P: 553
How would i pass the TabControl to a function?

I have a function:
Expand|Select|Wrap|Line Numbers
  1. Public Function processCount(ctrlName As TabControl) As Integer
  2. ....
Call :
Expand|Select|Wrap|Line Numbers
  1. 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:
Expand|Select|Wrap|Line Numbers
  1. processCount( TabCt1.Name = [Page 2])
But then i get compile error within the function :
"Method or data member not found"

when i do this
Expand|Select|Wrap|Line Numbers
  1. For Each Ctrl In pageName.Controls

Help please?
Jul 26 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,532
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)>
Jul 26 '07 #2

Expert 100+
P: 1,206
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:
Expand|Select|Wrap|Line Numbers
  1. Dim intx as Integer
  3. intx = processCount(Me.TabCtl0)
Or you can change the Function to take in a page instead of a tabcontrol

Expand|Select|Wrap|Line Numbers
  1. Public Function processCount(ctrl as Page) As Integer
  2. End Function
  4. 'call it
  5. intx = processCount(Me.Page2)
Jul 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.