Can somebody please tell me what I'm doing wrong? I am creating a TCPClinet. I have 2 errors and both of them come back to this line.

connectSocket.Send(System.Text.Encoding.UTF8.GetBytes(sendText));

The errors are:
1. The best overloaded method match for 'System.Text.Encoding.GetBytes(char[])' has some invalid arguments
2. Argument '1': cannot convert from 'System.Windows.Forms.TextBox' to 'char[]'

connectSocket is the name of my open socket.
sendText is the name of the textbox where I type in what to send to the server like GET and stuff.

Recommended Answers

All 6 Replies

I'm assuming sendText is a textbox.

You need to get the text not the textbox

sendText.Text

I think the same.
Don't call your textboxes "sendText".
Use something like "sendTextTxb" that way you will get less confused.

I'll second ddanbe.

I will always name my textboxes prefixed with tb
example: tbSendText

I'll 3rd that.

Thank you, that worked. I'm stupid

No you are not stupid.
There are no stupid questions, the anwsers might be...

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.