Solved

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

Posted on 2004-09-09
3
433 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
[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
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.

738 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