Good day! I am having troubles on getting all the items, selected or not, from the listbox. Whenever I click the send button, the only items that I could get is the ones I selected (This is the current results of my code below: http://imgur.com/jA94Bjm). What I want is to get all the items from the textbox not just from the selected ones and which is not repeating.
private void cmd_send_Click_1(object sender, EventArgs e)
{
for (int i = 0; i < listBox1.Items.Count; i++)
{
try
{
String pno = textBox4.Text.ToString();
String path = textBox5.Text.ToString();
String name = textBox6.Text.ToString();
String user = textBox7.Text.ToString();
output.Text += "\n Sent data : " + pno + " " + user + " " + name + " " + path;
}
catch (Exception ex)
{
wait.Abort();
output.Text += "Error..... " + ex.StackTrace;
}
NetworkStream ns = tcpclnt.GetStream();
String data = "";
data = "--++" + " " + textBox4.Text + " " + textBox5.Text + " " + textBox6.Text + " " + textBox7.Text;
if (ns.CanWrite)
{
byte[] bf = new ASCIIEncoding().GetBytes(data);
ns.Write(bf, 0, bf.Length);
ns.Flush();
}
}
}