Home Can I use a string as a name in Visual Basic to change an objects properties?
Reply: 0

Can I use a string as a name in Visual Basic to change an objects properties?

user776
1#
user776 Published in May 24, 2018, 4:01 pm

My Idea is not too hard. I have a button, a string called "progname", a TextBox and three Progressbars.

When I enter a number into the TextBox and press the button, the following code run's through.

Dim progname As String
    progname = "Progressbar" & TextBox1.Text

Now I have a string called "progname" with relevant value.For an example "Progressbar2".

What I want to achieve is write something like:

progname.Value += 1 

Which can't be done, as "Value" is not a Member of "String". How can I do this? Overall what I want, is to be able to select one of the three progressbars by typing one of the numbers 1-3 into the TextBox and then change that ones porperties.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.337426 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO