OK, that makes sense. Thanks for your help.
Jay
"Fabrizio Romano" <sf*****@zerovolt.comwrote in message
news:45***********************@reader4.news.tin.it ...
"Jay" <nospamwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
Extracted from the C# example in
http://msdn2.microsoft.com/en-us/library/s14dyf47.aspx...
public static void Main()
{
string name;
string message;
StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
Thread readThread = new Thread(Read);
// Create a new SerialPort object with default settings.
_serialPort = new SerialPort();
<snip>
I would have thought that the last line would need to be:
SerialPort _serialPort = new SerialPort();
I didn't check the link, but probably the _serialPort property is just
declared outside this method.
Something like:
class blabla {
private static SerialPort _serialPort;
public static void Main() {
_serialPort = new SerialPort();
}
private static void AnotherMethod() {
// do something with _serialPort here
}
}
this way you can access the _serialPort property also from outside the main
method.
HTH
Fabrizio