Solved

Object = nothing?

Posted on 2002-03-05
6
129 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now