Click here to Skip to main content
12,510,403 members (47,582 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
I want to take Array Input (more then 1 number) with a single textbox. and i want to show it on a list box. can any buddy help me.
Posted 27-Nov-12 23:34pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You have to use a input separator (e.g. blank) and then split according the input text, e.g.
// suppose textBox.Text = "12 1 24 35";
string [] sna = textBox.Text.Split(new char[] {' '});
 
foreach( string sn in sna )
{
  listBox.Items.Add(sn);
}
  Permalink  
Comments
Mathlab 28-Nov-12 18:22pm
   
you could have just dont a .toList
Muhamad Faizan Khan 3-Dec-12 7:32am
   
what does split do?
CPallini 3-Dec-12 8:01am
   
That's well explained in the relative documentation:
http://msdn.microsoft.com/en-us/library/system.string.split.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100