I have a Global Boolean variable in my project in Visual Basic. named YesNo01
I wish to make it True through the Click event of a Button . However, instead of setting it True directly by using this Boolean Variable’s own name, I wish to set it True using a String Variable that is carrying its name.
So what I am looking for is something like this:
1. Dim YesNo01 As Boolean
2. Dim myString as String
3. myString = “YesNo01”
4. myString = True
I had hoped that the 4th line of code will make YesNo01 = True, but this does not work.
I wish to know if it is possible to achieve something like this. That is passing the name of one Boolean Variable in a String Variable and then setting the orginal Boolean variable true using that string variable. I hope I have been able to clarify my question.
Thank you for your help.
Best wishes
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.