vb.net - New control vs control -
is new control
needed create control or can 1 use control
? example:
dim label1 label
vs dim label1 label= new label
question 1:
here made reference;
dim label1 label
you can't use 1 jet, won't work;
label1.text = "yadda"
you error like; object not instance of declaring class
here made reference plus instance;
dim label1 label= new label
you can use instance;
label1.text = "yadde"
in .net 'control' not variable, it's class; http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx
question 2:
if put control on form, , change it, change on form! don't have add them again form!
question 3:
controls.remove method of form, example;
form1.controls.remove(label1)
you need refer form1 inside own class 'me' ;
me.controls.remove(label1)
it detaches control form, stil there.
if want 'remove' should,
me.controls.remove(label1) label1.dispose()
Comments
Post a Comment