Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21845

Many buttons do the same thing

$
0
0
Every button posts a letter a label.
Btn_A.Text = "A" and Btn_B.Text = "B" etc..
Is it possible to make every button post its own btn.text into a label, without having to write so many lines of code?

The code as it is now:

Public Sub Alleknapper(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Btn_A.Click, Btn_B.Click, Btn_C.Click, etc.......

Select Case True
Case sender Is Btn_A
Label1.Text += Btn_A.Text
Case sender Is Btn_B
Label1.Text += Btn_B.Text
Case sender Is Btn_C
Label1.Text += Btn_C.Text

etc.......

End Select

Viewing all articles
Browse latest Browse all 21845

Trending Articles



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