Solved

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

Posted on 2004-09-09
3
418 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
java continue statement 10 73
Installed softare without GUID 6 54
PHP question(s) about order of output 9 42
C# Error - Add Failed 12 49
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

23 Experts available now in Live!

Get 1:1 Help Now