[RESOLVED] [Help]Adding a Variable to a Control.
I'm trying to add a varible to a control, so I can reference the Variable with the Controls name. I would like to set the variable how you would set a regular Integer. This is an example of what I mean:
Code:
Messagebox.Show("The ID of Button1 is " & button1.ID & ".")
Result:
The ID of Button1 is 1.
If someone could tell me if this is possible or not. I would like to think it is however.
Re: [Help]Adding a Variable to a Control.
I don't think you can. I don't think you can make a variable part of the control. Why not just set a global variable and call it when appropriate?
Re: [Help]Adding a Variable to a Control.
you can by inheriting the control, then adding all the properties you want to it.... but there might be easier ways as well... but it depends on what exactly you are trying to accomplish. If all you want is some kind of ID number that is fairly arbitrary, look at using the .Tag property.
-tg
Re: [Help]Adding a Variable to a Control.
Thank you techgnome. I did a simple Search on "inherit" and found this thread. So using the code provided, I've managed to do EXACTLY what I was looking for.
Here's the code that I used:
Code:
Public Class MyButton
Inherits Button
Public ID as Integer
End Class
Thanks techgnome!