Author Topic: Basic Button and "Tag" property  (Read 1221 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Basic Button and "Tag" property
« on: September 06, 2015, 09:35:05 AM »
Below the TabStop , there is "Tag" property. What does this do?  TIA.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basic Button and "Tag" property
« Reply #1 on: September 06, 2015, 09:55:52 AM »
The Tag property serves no specific purpose. It is intended to be a user property. For instance, if you have several buttons and a single click event handler, you can put different numbers in the Tag property for each button and use that value for some specific purpose.


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click, Button3.Click
        System.Windows.Forms.MessageBox.Show("The Tag value for the button that was clicked is " & sender.Tag)
    End Sub


You can find more techinal information here:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.tag(v=vs.110).aspx