Solved

Different arguments based on a boolean value

Posted on 2006-07-13
3
208 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
  • 2
3 Comments
 
LVL 14

Expert Comment

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

Author Comment

by:TommyTwoPints
Comment Utility
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 500 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

7 Experts available now in Live!

Get 1:1 Help Now