This control array should work, right?
-
I know .NET is different than 6 wrt control arrays. But shouldn't I be able to capture the CLICK on the following (fragment)? Dim contArray(2) as Button for i = 0 to 1 contArray(i) = new Button contArray(i).tag = i controls.add(contArray(i)) next i ... private sub contArray_CLICK (...) or something that lets me get the tag or index of the button clicked. -David
-
I know .NET is different than 6 wrt control arrays. But shouldn't I be able to capture the CLICK on the following (fragment)? Dim contArray(2) as Button for i = 0 to 1 contArray(i) = new Button contArray(i).tag = i controls.add(contArray(i)) next i ... private sub contArray_CLICK (...) or something that lets me get the tag or index of the button clicked. -David
Here is an example of how to do it in both VB.NET and C# CodeProject Clickety[^] Please keep in mind that I do not like how the article is formatted, but the content is ok.
Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things."
-
Here is an example of how to do it in both VB.NET and C# CodeProject Clickety[^] Please keep in mind that I do not like how the article is formatted, but the content is ok.
Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things."
Thanks, works pretty good. If I want to add the control array to a panel instead of a form, how would I declare the control?
-
Here is an example of how to do it in both VB.NET and C# CodeProject Clickety[^] Please keep in mind that I do not like how the article is formatted, but the content is ok.
Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things."
Thanks, works pretty good. If I want to add the control array to a panel instead of a form, how would I declare the control? assuming a Panel1 on the main form, Dim ControlArray as ButtonArray(Panel1) 'doesn't work since Panel1 is not a "form" container
-
Thanks, works pretty good. If I want to add the control array to a panel instead of a form, how would I declare the control? assuming a Panel1 on the main form, Dim ControlArray as ButtonArray(Panel1) 'doesn't work since Panel1 is not a "form" container
-
Instead, change the Form reference to be an "IContainer" control since all Controls and Forms inherit from IContainer.
Thanks for the reply. But I'm new to .NET. If you mean, have the main form inherit from System.Windows.Form.IContainerControl it doesn't work. At least I get an error that says classes can inherit only from classes.