Solved

Object = nothing?

Posted on 2002-03-05
6
128 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

707 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

21 Experts available now in Live!

Get 1:1 Help Now