String Problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric

    #1

    String Problems

    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");
    }

    }
    }
  • Eric

    #2
    RE: String Problems

    n/m dumb mistake with "\r\n"

    Comment

    Working...