0

I have a listBox with numbers. I would like to sent the values from the listBox (on client- side) to another listbox (on server- side). The code works especially well with textBox1.Text (see below). I would like to have the numbers ( listbox on Server-Side) among each other(see figure). How can this be solved? Many thanks for your help and support!

//Client:

        private void button2_Click(object sender, EventArgs e)
        {           
           client.WriteLineAndGetReply(textBox1.Text,TimeSpan.FromSeconds(3));                           
        }

//Server:

        private void Server_DataReceived(object sender, SimpleTCP.Message e)
        {   
                textBox1.Invoke((MethodInvoker)delegate ()
                {
                    textBox1.Text += e.MessageString;
                    e.ReplyLine(string.Format(e.MessageString));
                });            
        }



enter image description here

Fildor
  • 14,510
  • 4
  • 35
  • 67
  • 1
    _"I would like to have the numbers ( listbox on Server-Side) among each other."_ Could you post an example of what this means? – Fildor Sep 06 '19 at 08:35
  • So, that's what you _have_. And in contrast to that (or additionally) what is your goal? I'm having a hard time understanding your question, because it is unclear what exactly you want to achieve. – Fildor Sep 06 '19 at 08:56
  • I have a textBox with numbers" : [ 1,2,3 ] on client side. I have also a textBox on server side. The output after sending: [1,2,3]. I would like to have something like that: listboxes with numbers on client side and on server side among each other : [1 2 3] I hope it has become clear what the diffrence is... –  Sep 06 '19 at 09:04
  • Ohhh, ... each number on its own line ... d'oh. Now I get it. – Fildor Sep 06 '19 at 09:10
  • Have a look at this: https://stackoverflow.com/a/8537564/982149 I guess it will help. – Fildor Sep 06 '19 at 09:12
  • It is possible to sent data like this: client.WriteLineAndGetReply(listBox25.Items...(TimeSpan.FromSeconds(3)); However, thank you very much for all your efforts, Fildor! –  Sep 06 '19 at 09:36

0 Answers0