Solved

What  type of object

Posted on 2002-04-25
7
159 Views
Last Modified: 2010-05-02
I am passing a variant to a procedure. In the procedure I want to find out what type of an object I have passed. I am passing textboxes, combo boxes and datepickers. Each are handled slightly differently in the procedure. I know the is a function to tell what kind of object something is. What is it and will it work in this case.

Edel
0
Comment
Question by:edel2000ie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 6967974
debug.print typename(object)

or

if typeof object is textbox then
end if
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6967982
Vartype(object)

Returns an Integer indicating the subtype of a variable.


0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6967983
Sorry, VarType is not the right one in this case

Use crazyman's TypeOf
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 6968011
TypeName is probably better in this instance:

Public Sub DoSomething(ByRef Something As Variant)
Select Case TypeName(Something)
Case "TextBox"
Case "CommandButton"
Case "Timer
Case "FileListBox
Case "DirListBox
Case "DriveListBox
Case "HScrollBar
Case "VScrollBar
Case "PictureBox
Case "CommandButton
Case "Frame
Case "TextBox
Case "OptionButton
Case "CheckBox
Case "ComboBox
Case "ListBox
Case "HScrollBar
Case "TabStrip
Case "Toolbar
Case "TreeView
Case "ProgressBar
Case "StatusBar
Case "ImageList
Case "ListView
Case "ImageCombo
Case "MonthView
Case "FlatScrollBar
Case "UpDown
Case "DTPicker
Case "Adodc
Case "OLE
Case "Image
Case "Line
Case "Shape
Case "Label
End Select
End Sub

0
 

Author Comment

by:edel2000ie
ID: 6968074
Thank you Tim Cottee. Excellent answer. I was going with Typeof but your example suits perfectly. All help from everyone much appreciated

Bye

Edel
0
 
LVL 13

Expert Comment

by:crazyman
ID: 6968076
;o(
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6968100
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 43
using Access 8 84
Advice in Xamarin 21 109
Inserting a datasheet query into the body of an email using VBA? 4 52
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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