[Year 12 SofDev] C# - Adding data to an Array from user input
Cooper, Michael J
cooper.michael.j at edumail.vic.gov.au
Mon Feb 6 16:34:53 AEDT 2017
Thanks Ben the list methods seem like a much cleaner way to do it
Michael Cooper
ICT Co-ordinator & Network Support
[id:image001.png at 01D2440D.0D6FCCA0]
braybrooksc.vic.edu.au<http://www.Braybrooksc.vic.edu.au>
Ph. 9312 2900
From: <sofdev-bounces at edulists.com.au> on behalf of Ben Hines <b.hines at ccg.vic.edu.au>
Reply-To: Year 12 Software Development Teachers' Mailing List <sofdev at edulists.com.au>
Date: Monday, 6 February 2017 at 2:46 pm
To: Year 12 Software Development Teachers' Mailing List <sofdev at edulists.com.au>
Subject: Re: [Year 12 SofDev] C# - Adding data to an Array from user input
Um,
The problem with arrays is that they are made with a fixed size.
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.
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).
Hope that helps!
Regards,
Ben Hines
Ben Hines
Mathematics and ICT Teacher
Senior School - Waurn Ponds
(03)5241 1577
[hristian College Geelong]
[https://www.ccg.vic.edu.au/email/images/Enviro.jpg] Please consider the environment before printing this email.
From: sofdev-bounces at edulists.com.au [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Cooper, Michael J
Sent: Monday, 6 February 2017 12:58 PM
To: Year 12 Software Development Teachers' Mailing List <sofdev at edulists.com.au>
Subject: [Year 12 SofDev] C# - Adding data to an Array from user input
Hello fellow SD teachers,
C# coding question - what is the best way to allow a USER to enter data into an array using a GUI, not the console?
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.
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.
Or am I going about this the wrong way entirely and should be using another technique?
Michael Cooper
ICT Co-ordinator & Network Support
[cid:image002.png at 01D28096.F1887F70]
braybrooksc.vic.edu.au<http://www.Braybrooksc.vic.edu.au>
Ph. 9312 2900
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.
________________________________
Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au
Report this message as spam<https://console.mailguard.com.au/ras/1Qd3zTUEZM/1ibn1N2QYL7pAHC9BDIL3b/0>
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.
________________________________
Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20170206/49990ed4/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9943 bytes
Desc: image001.png
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20170206/49990ed4/image001-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 12483 bytes
Desc: image002.png
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20170206/49990ed4/image002-0001.png
More information about the sofdev
mailing list