troubleshooting Question

How to pass the name of a Bolean variable in a String Variable and then Use that String Variable as a Replacement for the Name of the Boolean Variable in Code

Avatar of FaheemAhmadGul
FaheemAhmadGulFlag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingVisual Basic Classic
4 Comments1 Solution312 ViewsLast Modified:
This question is related to another question I asked on the Forum today and which was very kindly answered by Idle_Mind.

I have a Global Boolean variable in my project in a Visual Basic  .NET Project  named    YesNo01. This YesNo01 is declared in a Module1 of my Project.

I wish to write some code along the following lines
1. If  YesNo01 = True Then
2. MessageBox.Show (“YesNo01 = True”)
3. Else
3. MessageBox.Show (“YesNo01 = False”)
4. End if

However  I do not want to use the actual Name of  YesNo01  in statement No 1. Instead I wish to say something like the following:

Dim myString as String
myString = “YesNo01”
If myString = True Then
MessageBox.Show (“YesNo01 = True”)
MessageBox.Show (“YesNo01 = False”)
End if

Thank you for your help in anticipation.
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros