Sheldon said:
In versions of VB prior to .net, I was able to create in code an array of
controls, such as
for i = 1 to 10
Load Me.lblTest(i)
Me.lblTest(i).top = me.lblTest(i-1).top - me.lblTest(i-1).height -
200
Me.lblTest(i).visible = true
next i
where lblTest(0) already exists on the form.
How do I do this in VB.net
Thanks
You need to get used to the object thing in .net.
It's a different way of looking at things.
So..
You can inherit one control from another.
So you could create a new control based on like a "master" label0.
That way it inherits all the event code you have.
Depends on the reason you want to do this though.
Say you want to run access reports from vb.
So you have some code works out what you got in a given mdb dynamically and
your use of control array functionality was so you had a label and button
per report.
You want a list of reports, descriptions and buttons and all built
dynamically.
Click on a button and your code runs the report it's next to.
You could do this using a datagrid based on an array.
Arrays contain objects now.
So you can have a class exposes 3 properties, rep_description, rep_name,
rep_access_name.
Link a datagrid to an array of these.
You need to look into getting a button into a grid and turn off append but
that's all on george shepherd's faq page ( google, it now if you ain't read
his stuff).
Otherwise the code's kind of easier.
Well, less messy.
No mucking about getting button two under button3.
You can't hit the end of a page.
Well, maybe not the first time you write it, seeing as how it's different.
But the second time'll be easy.
If you were doing asp.net I reckon probably even simpler because you'd have
a more suitable control available.
Seems to me they invested more effort in the asp functionality.
Mind you, it needed fixing more.