Solved

Object = nothing?

Posted on 2002-03-05
6
133 Views
Last Modified: 2010-05-02
hi,

i use an optional argument in a method for my DLL,
this argument is an object (a progressbar)

how do i test if the programmer passed a progressbar, or didn't pass a progressbar?

Public Function TreeviewShowRecordsForAllTables(DatabaseName As String, Treeview As Object, Optional ProgresBar As Object)

if progresbar = nothing then
'does not work...


cheers
Ricky
0
Comment
Question by:Paurths
[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
6 Comments
 
LVL 4

Accepted Solution

by:
trkcorp earned 100 total points
ID: 6842562
if not OBJECT Is Nothing then
  'OBJECT Exists
Else
  'OBJECT is Nothing
End If
0
 
LVL 2

Expert Comment

by:dirkmartin
ID: 6842571
use the following:

If IsMissing(ProgresBar)
0
 
LVL 15

Expert Comment

by:ameba
ID: 6842582
IsMissing is to be used if optional argument is declared As Variant.

Use what trkcorp said "if progresbar IS nothing"
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 12

Expert Comment

by:jgv
ID: 6842632
If the parameter is a valid object, then you can also check that it reference's a progressbar:

Private Sub CheckIt(Optional objProgBar As Object)

    If objProgBar Is Nothing Then
        MsgBox "Parameter is missing"
        Exit Sub
    End If
   
    If Not TypeOf objProgBar Is ProgressBar Then
        MsgBox "Parameter is present, but not a progressbar"
        Exit Sub
    End If
   
    MsgBox "Parameter includes a progressbar"

End Sub
0
 
LVL 12

Author Comment

by:Paurths
ID: 6842634
ok, excellent,

one more thing,
i am also passing a treeview

how do u clear a treeview? (remove all nodes)
0
 
LVL 12

Author Comment

by:Paurths
ID: 6842648
clear  ofcourse...dumb of me...

cheers
Ricky
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month7 days, 9 hours left to enroll

632 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