Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

1 solution

You have to use a input separator (e.g. blank) and then split according the input text, e.g.
C#
// suppose textBox.Text = "12 1 24 35";
string [] sna = textBox.Text.Split(new char[] {' '});

foreach( string sn in sna )
{
  listBox.Items.Add(sn);
}
 
Share this answer
 
Comments
[no name] 28-Nov-12 18:22pm    
you could have just dont a .toList<string>()
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900