<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:mv="http://macVmlSchemaUri" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Arial;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Webdings;
        panose-1:5 3 1 2 1 5 9 6 7 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:Calibri;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:EN-US;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:Calibri;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:Calibri;
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:595.0pt 842.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks Ben the list methods seem like a much cleaner way to do it<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">Michael Cooper<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">ICT Co-ordinator &amp; Network Support<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB"><img width="223" height="37" id="_x0000_i1030" src="cid:image001.png@01D28096.F1887F70" alt="id:image001.png@01D2440D.0D6FCCA0"></span><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;"><a href="http://www.Braybrooksc.vic.edu.au">braybrooksc.vic.edu.au</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;">Ph. 9312 2900<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</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 style="color:black">From: </span></b><span style="color:black">&lt;sofdev-bounces@edulists.com.au&gt; on behalf of Ben Hines &lt;b.hines@ccg.vic.edu.au&gt;<br>
<b>Reply-To: </b>Year 12 Software Development Teachers' Mailing List &lt;sofdev@edulists.com.au&gt;<br>
<b>Date: </b>Monday, 6 February 2017 at 2:46 pm<br>
<b>To: </b>Year 12 Software Development Teachers' Mailing List &lt;sofdev@edulists.com.au&gt;<br>
<b>Subject: </b>Re: [Year 12 SofDev] C# - Adding data to an Array from user input</span><span style="color:black;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;"><o:p>&nbsp;</o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Um,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">The problem with arrays is that they are made with a fixed size.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">You can easily have a textbox (or NumericInput) control, then a button that adds to the array. You will need to have a counter variable that keeps track of where you are in the array.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Or you could just use a List&lt;T&gt; which has methods for adding and removing from the list (List is just an array with lots of helpful functions that make it easier to use).</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hope that helps!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Ben Hines</span><o:p></o:p></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p></o:p></a></p>
<p id="c1-id-7"><strong id="c1-id-12"><span style="font-family:Calibri;color:maroon">Ben Hines</span></strong><b><span style="font-family:Calibri;color:maroon"><br id="c1-id-13">
</span></b><span style="font-family:Calibri;color:maroon">Mathematics and ICT Teacher<br id="c1-id-15">
Senior School - Waurn Ponds<br id="c1-id-16">
(03)5241 1577</span><span style="font-family:Arial"><o:p></o:p></span></p>
<p id="c1-id-17"><span style="font-family:Calibri"><img border="0" width="800" height="120" id="c1-id-25" src="https://www.ccg.vic.edu.au/email/images/ccg.jpg" alt="hristian College Geelong"></span><span style="font-family:Arial"><o:p></o:p></span></p>
<p id="c1-id-26"><b><span lang="EN-AU" style="font-size:16.0pt;font-family:Webdings;mso-fareast-language:JA"><img border="0" width="34" height="28" id="c1-id-30" src="https://www.ccg.vic.edu.au/email/images/Enviro.jpg"></span></b><strong><span lang="EN-AU" style="font-size:16.0pt;font-family:Calibri;mso-fareast-language:JA">&nbsp;</span></strong><span style="font-size:10.0pt;font-family:Calibri">Please
 consider the environment&nbsp; before printing this email.</span><span style="font-family:Arial"><o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-AU"> sofdev-bounces@edulists.com.au [mailto:sofdev-bounces@edulists.com.au]
<b>On Behalf Of </b>Cooper, Michael J<br>
<b>Sent:</b> Monday, 6 February 2017 12:58 PM<br>
<b>To:</b> Year 12 Software Development Teachers' Mailing List &lt;sofdev@edulists.com.au&gt;<br>
<b>Subject:</b> [Year 12 SofDev] C# - Adding data to an Array from user input</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Hello fellow SD teachers,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">C# coding question - what is the best way to allow a USER to enter data into an array using a GUI, not the console?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I’ve used InputBoxes and loops with Visual Basic, however InputBoxes don’t seem to be thing in C#, without adding the Microsoft.VisualBasic namepace.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I can add data to an array during design time easily enough, but I want the USER to be able to click on a button and be prompted to enter data, which then populates the array.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Or am I going about this the wrong way entirely and should be using another technique?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">Michael Cooper</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">ICT Co-ordinator &amp; Network Support</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB"><img border="0" width="223" height="37" id="_x0000_i1027" src="cid:image002.png@01D28096.F1887F70"></span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;"><a href="http://www.Braybrooksc.vic.edu.au">braybrooksc.vic.edu.au</a></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;">Ph. 9312 2900</span><o:p></o:p></p>
</div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0">
<tbody>
<tr>
<td style="background:white;padding:.75pt .75pt .75pt .75pt">
<pre><span style="color:black">IMPORTANT - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Training.</span><o:p></o:p></pre>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-AU">&nbsp;</span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-AU">
<hr size="1" width="100%" align="center">
</span></div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-AU">Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.<br>
<a href="http://www.mailguard.com.au">http://www.mailguard.com.au</a><br>
<br>
<a href="https://console.mailguard.com.au/ras/1Qd3zTUEZM/1ibn1N2QYL7pAHC9BDIL3b/0">Report this message as spam</a> &nbsp;<br>
&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB"><br>
This e-mail is intended for the use of the named individual or entity and may contain confidential and privileged information. Any dissemination, distribution or copying by anyone other than the intended recipient of this e-mail is strictly prohibited. If this
 e-mail has been received in error, then please notify Christian College or the author of this email immediately and destroy the original message. We have made every attempt to ensure this e-mail message is free from computer viruses however the attached files
 are provided on the basis that the user assumes all responsibility for use of the material transmitted. Views, opinions, etc. expressed reflect those of the author and not Christian College nor its associated companies and campuses which includes Eden Quality
 Services Pty Ltd.<o:p></o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">
<hr size="1" width="100%" align="center">
</span></div>
<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;;mso-fareast-language:EN-GB">Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.<br>
<a href="http://www.mailguard.com.au">http://www.mailguard.com.au</a><br>
&nbsp;<br>
&nbsp;<br>
<br>
<o:p></o:p></span></p>
</div>
</body>
</html>

<table><tr><td bgcolor=#ffffff><font color=#000000><pre>IMPORTANT - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Training.</pre></font></td></tr></table>