Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object = nothing?

Posted on 2002-03-05
6
Medium Priority
?
134 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 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
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.

 
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

Technology Partners: 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…
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 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 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

688 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