Thursday, 19 September 2013

Some errors i can not solve c#

Some errors i can not solve c#

I have some errors i can not fix.
This are the errors:
Error 1 'Communication.ComPort' is a 'type' but is used like a 'variable'
Error 2 Only assignment, call, increment, decrement, and new object
expressions can be used as a statement

This is the code where the errors apear:
private void BackgroundWorkerCompletedEvent(object sender,
RunWorkerCompletedEventArgs e)
{
Object result;
ComPort comport = ComPort();
try
{
result = e.Result;
}
catch (Exception exc)
{
MessageBox.Show("Sending file(s) failed: " +
exc.InnerException.Message, "", MessageBoxButtons.OK);
_dialog.Close();
return;
}
if (_aborted)
{
comport.Close;
MessageBox.Show("Sending file(s) aborted, Reset
programmer.", "", MessageBoxButtons.OK);
}
else if (Success)
MessageBox.Show("Sending File(s) succesfull", "",
MessageBoxButtons.OK);
else if (!Success)
comport.Close;
else if (_comPort == null)
MessageBox.Show("Programmer not found at port " + _port,
"", MessageBoxButtons.OK);
else
MessageBox.Show("Sending file(s) failed: ", "",
MessageBoxButtons.OK);
_dialog.Close();
}
Can someone explain to me what i am doeing wrong so i can learn from it.
Thanks in advance

No comments:

Post a Comment