Ive developed a simple p2p chat program, it works fine up until i get to the input/output streams

in my void that recieves incoming text i have the following code...

public void listen()
        {
            while (true)
            {
            again:
                try
                {
                    convobox.AppendText(Input.ReadLine);
                }
                catch
                {
                    goto again;
                }
            }
        }

it says that it has some invalid arguments,
what am i doing wrong?

Recommended Answers

All 9 Replies

Input.ReadLine()?

"Input" is the incoming text from the stream of the TCP connection,
what the piece of code is meant to do is read incoming text from the stream and put it in a box

And I would expect using Input.ReadLine to get you an error about a type mismatch, so maybe you meant Input.ReadLine().

How to i Convert Input.ReadLine() into a String?

You're going to have to give more information. What is the type of Input?

method group

Then why are you trying to get a ReadLine property off of a method group? That makes no sense.

becuase it reads the incoming text from the connection (Input.ReadLine()) and displays it in a textbox (convobox.Text = Input.ReadLine())

If Input is a method group, then you can't call a method on it. That makes no sense. You might have some serious misconceptions; maybe try answering this question a second time: What is the type of the variable or property, Input?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.