Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Object = nothing?

Posted on 2002-03-05
6
Medium Priority
?
135 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 400 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Industry Leaders: 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

926 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