Solved

VB.NET Windows App - Optional Sub Parameter byRef Object default no reference

Posted on 2004-09-09
3
430 Views
Last Modified: 2010-04-17
Hello,

I have a VB.NET Sub routine with 3 parameters.  The last is " ByRef Optional ilsList As ImageList".

What the routine does internally varies, depending on whether it is called with an ImageList reference.  I therefore need to be able to check if this parameter was called.

I guess I need to assign a DEFAULT value to this reference... not sure how to do this.  I assumed maybe assigning NULL would work and allow me to do an ISREFERENCE() check against the ilsList object.  But this doesn't seem to work.

Any ideas?

Thanks in advance!
0
Comment
Question by:quiTech
3 Comments
 
LVL 1

Accepted Solution

by:
Edy_l earned 500 total points
ID: 12022776
I assume ilsList  is ImageList type object, so try this

Function A(ByRef Optional ilsList As ImageList = nothing)
     'do your checking here
     If not lsLists is nothing then
          '...some code
     End If
End Function

Cheers,
Ed


0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12022911
I think Edy_l is right
0
 

Author Comment

by:quiTech
ID: 12022956
Works great!  Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

820 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