help in c sharp

  • Thread starter Thread starter asif
  • Start date Start date
A

asif

i am new with c sharp....
can u please tell me what is wrong here....


try
{
//message = _serialPort.ReadLine();

if (_serialPort.ReadLine()== "asif")
{
_serialPort.WriteLine("asif is there:");
}
else
{
_serialPort.WriteLine("someone is there:");
}

}
catch (TimeoutException) { }
}


it always go to the else part....
i will be thank ful...
 
asif said:
i am new with c sharp....
can u please tell me what is wrong here....


try
{
//message = _serialPort.ReadLine();

if (_serialPort.ReadLine()== "asif")
{
_serialPort.WriteLine("asif is there:");
}
else
{
_serialPort.WriteLine("someone is there:");
}

}
catch (TimeoutException) { }
}


it always go to the else part....
i will be thank ful...

Well, what are you doing that would make you expect it to receive
"asif"? If you uncomment the "message" line, what's the value of
message?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top