Hi, how can I implement a button array in Visual Studio 2005 ?
If you search the MSDN site, they have an article on how to simulate a control array. I think it sounds very awkward, but apparently it works.
Also, I recently proposed another way of simulating a control array. See this message for details. I believe this is a superior technique, because it actually allows you to quite simply reference them as an array. It was written for MS Access, and the sample code is for an array of textboxes. But you should be able to adapt it very easily for command buttons. There are bound to be some issues with this technique - for example I haven't yet addressed what will happen if you want to refer to the array from outside of the form, or add controls to the array at runtime. It's new, and still needs work.
it's not good!
i want to use it like VB6.
i have 12 buttons, and i want to call the same procedure by clicking of any one of them, but with a different index.
thanks
it's not good!
i want to use it like VB6.
i have 12 buttons, and i want to call the same procedure by clicking of any one of them, but with a different index.
Well, what can I say? Microsoft, in their infinite wisdom, seem to have decided we no longer need control arrays. While you and I may not agree with the decision, I don't see that there a lot we can do about it.
Keep in mind though, that you could place a simple stub in each event Sub to call your common procedure.
I also wonder whether there might be something about VB.Net which makes control arrays unnecessary. But I'm not in a position to answer that, only having VB6.
Comment