I'm having a problem comparing strings. In the following code I never get the message box to pop up. The text box does print "KEY" though. I've triend receive == "KEY" and receive.Equal(" KEY") but neither works.
public void WaitForPackets( )
{
while(true)
{
string receive;
byte[] data = client.Receive( ref receivePoint);
receive = System.Text.Enc oding.ASCII.Get String(data) + "\r\n";
textBox1.Text += receive;
if(receive.Equa ls("KEY"))
{
MessageBox.Show ("Yes");
}
}
}
public void WaitForPackets( )
{
while(true)
{
string receive;
byte[] data = client.Receive( ref receivePoint);
receive = System.Text.Enc oding.ASCII.Get String(data) + "\r\n";
textBox1.Text += receive;
if(receive.Equa ls("KEY"))
{
MessageBox.Show ("Yes");
}
}
}
Comment