Say I have a form application, and I draw a circle inside of it. Could I store a variable inside that circle object? Something like this?
Dim circle1.testVar As Integer = 1
Would that work, and is there a way to do this if it won't?
No, you cannot dynamically add properties to a Control. you can use the existing Tag property of a control:
circle1.Tag = 1
Unfortunately Tag is of type Object so you're going to have to check for Nothing and/or cast the value when you retrieve it.
Tag is still defined as an Object so you'll still need to cast when retrieving it.circle1.Tag = new Dictionary<string, int>() for example to store multiple int values. To set a value: ((Dictionary<string, int>)circle1.Tag)["testVar"] = 1;Console.WriteLine(circle1.Tag(0).ToString)
Circleclass has a propertytestVar. And you would set it in this way:circle1.testVar = 1