I got the following problem
Code:
void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textBox1.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);\
serverStream.Flush();
textBox1.Clear();
}
}
the code seems to be right, must be when i press enter it should get the function, but when i press enter (or when i replace to any other key) it just makes a horrible sound in my windows form.
when I get this command in a button:
Code:
private void button1_Click(object sender, EventArgs e)
{
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textBox1.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
textBox1.Clear();
}
then there is no problem. I really need help I dont know why it is. it must be something with like my Windows form dont know the keys im pressing.