Question Basic Q on Classes, Objects, Instances & redirection

jojo76

New member
Joined
May 21, 2011
Messages
1
Programming Experience
5-10
While new to OOP/VB.NET but not to programming, I am clearly one concept short of an understanding.

I want to write a simple generalised routine that will perform some basic actions on controls (textboxes, labels, etc.) where the name of the control will be passed as an argument.

I am clearly misunderstanding the use of classes & objects and would like to get a simple bit of code like this to work;

VB.NET:
Dim objLabel As New Label
- create a new instance from the Label class
VB.NET:
objLabel.name as "Label5"
- Trying to set up an indirect reference to a label (e.g. "Label5"
VB.NET:
objLabel.BackColor = color.black
- change the background colour of Label5

Obviously this does not set up the indirect reference I am looking for but how can I??

Thanks in advance
 
can i ask why you are creating the label from code and also, as far as i know, can NOT garantee 100% correct,
when you use
Dim objLabel As New Label

ObjLabel becomes the name of your label as far as i know.. if oyu looking to ref your label as label 5 then you should

dim Label_5 as new label

then you can start formating the label.

as far as i understand OOP. the class is almost like predefined settings and all sorts for your object. the class becomes an object when you
use 'dim ... as new ...

i dont know if this will help you much but i tried :D
 
Back
Top