control arrays
-
hi, I went to msdn and found some help, which told me to create the following lines of code:
// Declare a new ButtonArray object. ButtonArray MyControlArray; MyControlArray = new ButtonArray(this); // Call the AddNewButton method of MyControlArray. MyControlArray.AddNewButton();
Well seeing how the "ButtonArray" thing doesn't exist, I can't really do anything with this. How do I go about creating control collections in visual studio 2005 (programatically with ability to create an indefinite number of controls and remove them)? I will actually be applying this when creating my own control, I simply am having trouble programatically creating instances of a control that I don't know how many of it I will need. Hilf mir! Thanks -
hi, I went to msdn and found some help, which told me to create the following lines of code:
// Declare a new ButtonArray object. ButtonArray MyControlArray; MyControlArray = new ButtonArray(this); // Call the AddNewButton method of MyControlArray. MyControlArray.AddNewButton();
Well seeing how the "ButtonArray" thing doesn't exist, I can't really do anything with this. How do I go about creating control collections in visual studio 2005 (programatically with ability to create an indefinite number of controls and remove them)? I will actually be applying this when creating my own control, I simply am having trouble programatically creating instances of a control that I don't know how many of it I will need. Hilf mir! ThanksYou might do something like this:
List<Button> buttons = new List<Button>(); buttons.Add(new Button(...)); ...
To access the buttons you might do:foreach(Button b in buttons) { ... }
or use any functions List<> provides :)Pyro Joe wrote:
Hilf mir!
Gerne! ;) regards