I know, I know, VB isn't really a language

P2blr

Diabloii.Net Member
I know, I know, VB isn't really a language

but I am in a VB class at school, and I think I know more than the teacher, considering I get called over to fix people's problem's more than him. Anyway, I'm trying to dodge the ridicule of my (now) Java class, and instead of simply making a proggie the usual way, I want to make it almost entirely in code: by that I mean just have a form, and then create all the controls during runtime.
Now, I know how to add a control to an array during runtime; I know how to add a brand new control to a form during runtime. My problem is this: how do I create a new control array during runtime? I tried to change the Index to 0, but it said it was a read-only property. I tried to define it as an array in the declerations. help would definitely be appreciated, as the project is due on monday, and I've spent all my time working on creating the damn numbers to drag & drop.

Oh yeah, the version would be 6.0, so .NET code would be hard for me to understand right now >_<

thanks OTF, smartest group of people I don't know
 

Mad Merlin

Diabloii.Net Member
Unless you're planning on making the controls dynamically generated at runtime based on some parameter(s), there's not much point in implementing the program in the way you suggest, especially if you're just going to have the controls created at runtime, with all of the values and such hardcoded into the program. You'll only end up doing the same thing, but with more effort.
 

Hatsepsut

Banned
Hmm...been ages since I did VB...but I seem to remember you have to dim the empty array at first, upon which you can use ReDim to set the number of elements. ReDim Preserve to avoid erasing any previously assigned data.
 

P2blr

Diabloii.Net Member
Mad Merlin said:
Unless you're planning on making the controls dynamically generated at runtime based on some parameter(s), there's not much point in implementing the program in the way you suggest, especially if you're just going to have the controls created at runtime, with all of the values and such hardcoded into the program. You'll only end up doing the same thing, but with more effort.
that's the reason I'm doing it, VB has all this code hidden, and I'm trying to understand it better by manipulating it. or something

I can dynamically create a control, but it doesn't seem like I can create a control array that way, so I guess I'll just do it the half-assed way: create one, then use Load
 
Top