|
-
Nov 24th, 2009, 06:51 PM
#1
Thread Starter
Addicted Member
[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.
-
Nov 24th, 2009, 07:38 PM
#2
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?
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Nov 24th, 2009, 07:58 PM
#3
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
-
Nov 24th, 2009, 09:31 PM
#4
Thread Starter
Addicted Member
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|