<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=utf-8">
<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:"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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;
        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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
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",serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        mso-fareast-language:EN-US;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.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><!--[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 bgcolor="white" lang="EN-AU" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Um,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Or you could just use a List<T> 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).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hope that helps!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Ben Hines<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></a></p>
<span style="mso-bookmark:_MailEndCompose"></span>
<p style="font-family:Arial" id="c1-id-7"><font face="calibri" id="c1-id-8"><font face="calibri" id="c1-id-9"><font color="#800000" size="2" id="c1-id-10"><font size="3" id="c1-id-11"><strong id="c1-id-12">Ben Hines<br id="c1-id-13">
</strong></font><font size="3" id="c1-id-14">Mathematics and ICT Teacher<br id="c1-id-15">
Senior School - Waurn Ponds<br id="c1-id-16">
(03)5241 1577</font></font></font></font></p>
<p style="font-family:Arial" id="c1-id-17"><font face="calibri" id="c1-id-18"><font face="calibri" id="c1-id-19"><font face="calibri" id="c1-id-20"><font face="calibri" id="c1-id-21"><font face="calibri" id="c1-id-22"><font face="calibri" id="c1-id-23"><font face="calibri" id="c1-id-24"><img border="0" hspace="0" alt="Christian College Geelong" src="https://www.ccg.vic.edu.au/email/images/ccg.jpg" id="c1-id-25"></font></font></font></font></font></font></font></p>
<p style="font-family:Arial" id="c1-id-26"><font face="Calibri" id="c1-id-27"><span style="FONT-FAMILY: Webdings; FONT-SIZE: 16pt; mso-fareast-font-family: 'MS Mincho'; mso-fareast-theme-font: minor-fareast; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-AU; mso-fareast-language: JA; mso-bidi-language: AR-SA" id="c1-id-28"><strong id="c1-id-29"><img style="WIDTH: 22px; HEIGHT: 33px" alt="" src="https://www.ccg.vic.edu.au/email/images/Enviro.jpg" width="34" height="28" id="c1-id-30"> </strong></span><font size="2" id="c1-id-31">Please
consider the environment before printing this email.</font></font></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 <sofdev@edulists.com.au><br>
<b>Subject:</b> [Year 12 SofDev] C# - Adding data to an Array from user input<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt">Hello fellow SD teachers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt">Or am I going about this the wrong way entirely and should be using another technique?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif;mso-fareast-language:EN-GB">Michael Cooper<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif;mso-fareast-language:EN-GB">ICT Co-ordinator & Network Support<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif;mso-fareast-language:EN-GB"><img width="223" height="37" style="width:2.325in;height:.3833in" id="_x0000_i1025" src="cid:image002.png@01D28087.C92C2720" alt="id:image001.png@01D2440D.0D6FCCA0"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif"><a href="http://www.Braybrooksc.vic.edu.au">braybrooksc.vic.edu.au</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Times New Roman",serif">Ph. 9312 2900<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></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.<o:p></o:p></span></pre>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif;mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-family:"Times New Roman",serif;mso-fareast-language:EN-AU">
<hr size="1" width="100%" align="center">
</span></div>
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif;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> <br>
<o:p></o:p></span></p>
</div>
</body>
</html>
<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.<br>
<br><hr size=1>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>
<!-- MailGuard Message ID: 5897f19c4f6032 - use this number for reporting -->
<br> <br>