Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15151

VS 2019 How to simplify and compress code?

$
0
0
I have been using Visual Basic for about two years now and I would rate my skills at below average but good enough to do what i want.
In the programs I make, I have a tendency to e.g. have multiple buttons that do mostly the same thing but with a difference of

"when button1 is clicked then label1.text = 1" and "when button2 is clicked then label2.text = 2".

But I was wondering if there's a way to simplify this in a way of just having "when buttonX is clicked then labelX.text = X" and switching the X with the value thats needed in code?

It might sound silly but i have no idea how i would do this and I also dont know how to formulate this idea so i can search it up on the web.

Viewing all articles
Browse latest Browse all 15151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>