V
vbnewbie
I am having problems accessing properties of dynamically generated
objects in VB2005. Can someone please help?
In a nutshell:
My app creates an equal number of checkboxes and labels that share the
same Tag number. (I thought it might help)
The checkboxes name is a concatenation of "chkCancel" and a number that
represents the order in which they were created:
chkCancel0 (Tag = 0)
chkCancel1 (Tag = 1)
chkCancel2 (Tag = 2)
etc...
The same goes for the labels
lblLabel0 (Tag = 0)
lblLabel1 (Tag = 1)
lblLabel2 (Tag = 2)
etc...
When the label is created, its text property is given a value
(lblLabel.text = value).
What I want to do, is clear that text property when I click on the
corresponding checkbox.
I want to do it with a common sub, handler, whatever, that will work
for all checkboxes.
My problem is how to acces the label text property of a dynamically
created label.
Pseudo code:
lableTag = sender.tag
if sender.checked=true then
lblLabel(labelTag).text="" (this is the part I have trouble with)
I don't seem to be able to reference any object created dynamically...
It must be very simple for an experienced programmer, but not to
vbnewbie... and it is driving me nuts!
Thanks
objects in VB2005. Can someone please help?
In a nutshell:
My app creates an equal number of checkboxes and labels that share the
same Tag number. (I thought it might help)
The checkboxes name is a concatenation of "chkCancel" and a number that
represents the order in which they were created:
chkCancel0 (Tag = 0)
chkCancel1 (Tag = 1)
chkCancel2 (Tag = 2)
etc...
The same goes for the labels
lblLabel0 (Tag = 0)
lblLabel1 (Tag = 1)
lblLabel2 (Tag = 2)
etc...
When the label is created, its text property is given a value
(lblLabel.text = value).
What I want to do, is clear that text property when I click on the
corresponding checkbox.
I want to do it with a common sub, handler, whatever, that will work
for all checkboxes.
My problem is how to acces the label text property of a dynamically
created label.
Pseudo code:
lableTag = sender.tag
if sender.checked=true then
lblLabel(labelTag).text="" (this is the part I have trouble with)
I don't seem to be able to reference any object created dynamically...
It must be very simple for an experienced programmer, but not to
vbnewbie... and it is driving me nuts!
Thanks