Click here to Skip to main content
12,998,363 members (58,199 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, I am sure this is a very easy question for most of you, but forgive me.

I need to read the Serial Error. Something along the lines of...
private void serialPort1_ErrorReceived(object sender, System.IO.Ports.SerialErrorReceivedEventArgs e)
           SerialError = String CommErr;

I know its a type but dont know how to read it to a message box.

Many many thanks.
Posted 18-Apr-13 11:11am
Updated 18-Apr-13 11:12am
richcb 18-Apr-13 17:14pm
When declaring and instantiating a variable, the datatype always goes on the left. It should be something like this:

string CommErr = SerialError;

Now depending on what SerialError is, you might need to call the ToString() or a property that displays its text value.
Sergey Alexandrovich Kryukov 18-Apr-13 17:57pm
Also, it's not a string. Please see my answer. It's really difficult to help, at this phase...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Probably you mean SerialErrorReceivedEventArgs.EventType, its type is not string but System.IO.Ports.SerialError:[^],[^],[^].

So, it could be
System.IO.Ports.SerialError error = e.EventType;

Look, no matter what you want to achieve, it's apparent from your attempt to write code, that it is absolutely useless to write anything at all, at this level of knowledge. You can come back after you read some manual on programming, .NET and language from the very first page and learn how to write basic exercises. Think it would need too much time? But if you don't do it, you can waste a lot more, waste, instead of using time.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100