Answer to Question #37919 in C# for Ravi Patel
2013-12-19T15:14:13-05:00
string text = TextBox2.Text;
string sRaw = text.ToString();
string sClean = sRaw.Replace(",", " ");
text = sClean.Trim();
TextBox2.Text = text.ToString();
for (int i = 0; i < text.Length; i++)
{
if (text.ToString()!="")
{
ListBox5.Items.Add(Convert.ToString(text[i]));
}
else
{
Response.Write("a");
}
ListBox5.Items.Add(text.Split("\n"));
}
I want to move each item of string textbox = "1,21,45,785" into Listbox using this code...
please assist me............
Or correct the coding
1
2013-12-27T11:58:53-0500
Everything is a lot easier: string[] text = textBox2.Text.Split(','); foreach (string st in text) { if (st!="") { listBox5.Items.Add(st.Trim()); } }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C#
Comments
Leave a comment