<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><b><span style='font-size:14.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Mark,</span></b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> I had the same issue with the control arrays last year and apparently you can do it but it is done very differently. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have only ever programmed in VB6 and am not familiar with VB2010 and have managed to avoid it thus far. However, what you said made me revisit my earlier problem. It appears as though you can’t add the control array at design time, but do it at run time by creating and adding the controls to the form. I looked up some stuff on the web and found something that may help-although I really don’t know enough about it and I am sure that there are others on the list that know how to do this with bells on and could explain this much better.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have attached a zip file called LikeControlArray. It adds an array of buttons to a form (called </span><span style='font-size:9.5pt;font-family:Consolas'>btnMine_(i)) </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>and there is one event handler that handles all of the buttons-shown below. </span><span style='font-size:9.5pt;font-family:Consolas'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>Private</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>Sub</span> btnMine_Click(<span style='color:blue'>ByVal</span> sender <span style='color:blue'>As</span> System.<span style='color:#2B91AF'>Object</span>, <span style='color:blue'>ByVal</span> e <span style='color:blue'>As</span> System.<span style='color:#2B91AF'>EventArgs</span>) <span style='color:blue'>Handles</span> btnMine.Click<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> txtClick.AppendText(sender.Text())<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>End</span> <span style='color:blue'>Sub<o:p></o:p></span></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The bit I can’t understand is that I have to add a button called bntMine to the form at design time so that I can use </span><span style='font-size:9.5pt;font-family:Consolas'>btnMine.Click</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> as the handled event, but the buttons that I add when the form loads are all called </span><span style='font-size:9.5pt;font-family:Consolas'>btnMine_(i) .I have no clue about this.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I also added some checkboxes which you can process via a loop to see if they are checked, similar to what you had mentioned.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I hope this helps and that someone else on the list can explain the button thing that I mentioned above.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I was interested as I got the kids to do a hangman program in VB6 and it used control arrays and I was interested in doing it in VB2010. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Don Morelli<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> sofdev-bounces@edulists.com.au [mailto:sofdev-bounces@edulists.com.au] <b>On Behalf Of </b>Mark KELLY<br><b>Sent:</b> Tuesday, 24 May 2011 1:47 PM<br><b>To:</b> Year 12 Software Development Teachers' Mailing List<br><b>Subject:</b> [Year 12 SofDev] Assessor's report<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi folk. Sorry for posting about the ITA assessor's report to this list. I hope I didn't confuse you too much.<br><br>I've had SD on the brain recently* and forgot the complaint was about ITA.<br clear=all><br>*I'm finally nearly semi-competent in VB2010 and starting to forget my old VB6 habits, but I certainly miss control arrays. <br>Why MS ditched them I'll never know. It use to be SO easy to loop through an array of controls and do things with them, e.g. <br><br>For i =1 to 99<br> checkbox(i).checked = false<br>next<br><br>Sadly, you can't do that easily any more.<br><br>-- <br>Mark Kelly<br>Manager of ICT, Reporting, IT Learning Area<br>McKinnon Secondary College<br>McKinnon Rd McKinnon 3204, Victoria, Australia<br>Direct line / Voicemail: +613 8520 9085, Fax +613 9578 9253<br><a href="mailto:kel@mckinnonsc.vic.edu.au" target="_blank">kel@mckinnonsc.vic.edu.au</a><br>VCE IT Lecture Notes: <a href="http://vceit.com" target="_blank">http://vceit.com</a><br>Moderator: IT Applications Edulist<br><br>Want a good time? Call 0112358. Ask for Mr Fibonacci.<o:p></o:p></p></div></body></html>