63 818
Assignments Done
99,5%
Successfully Done
In August 2018

Answer to Question #37919 in C# for Ravi Patel

Question #37919
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
Expert's answer
Everything is a lot easier:

string[] text = textBox2.Text.Split(&#039;,&#039;);
foreach (string st in text)
{
if (st!=&quot;&quot;)
{
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions