?
Solved

Different arguments based on a boolean value

Posted on 2006-07-13
3
Medium Priority
?
215 Views
Last Modified: 2010-04-23
Hi Experts,

I have a routine in my application where i would like a different argument to be asked for depending on the boolean value.

If the boolean value = false  i would the the argument to be a variable structure (named VariableStructure)

if it =true then i would like the argument to be an ArrayList.

Would the only way around this be to make the argument type and object?

Cheers,

Tom
0
Comment
Question by:TommyTwoPints
[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
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17097379
What do you mean by "asked"? Do you need a user input?
0
 
LVL 3

Author Comment

by:TommyTwoPints
ID: 17097401
Sorry about the terminology.

I mean; I would like the argument variable type to be different depending on the value of a public boolean variable.
0
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 2000 total points
ID: 17097438
I think the only option is Object type if you want to use only one variable.
Suppose you have to variable types of yours VarType1 and VarType2.

Dim myVar as object
If myBool = True Then
   myVar = new VarType1
   'any necessery steps here
Else
   myVar = new VarType2
   'any necessery steps here
End if

Then later in your code:

If TypeOf myVar is VarType1 then
 ...
Else
 ...
End if

That's what I can suggest you.
0

Featured Post

Independent Software Vendors: 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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

752 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