Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
QuestionRe: Is this madness? The pursuit of single-statement methods Pin
BenScharbach12-Aug-17 9:48
BenScharbach12-Aug-17 9:48 
Questionhi Pin
Member 132829294-Jul-17 9:39
Member 132829294-Jul-17 9:39 
AnswerRe: hi Pin
Pete O'Hanlon4-Jul-17 10:53
mvePete O'Hanlon4-Jul-17 10:53 
AnswerRe: hi Pin
BenScharbach12-Aug-17 9:51
BenScharbach12-Aug-17 9:51 
QuestionC# Serial port data read and write Pin
Member 132923104-Jul-17 4:15
Member 132923104-Jul-17 4:15 
AnswerRe: C# Serial port data read and write Pin
OriginalGriff4-Jul-17 4:22
mveOriginalGriff4-Jul-17 4:22 
GeneralRe: C# Serial port data read and write Pin
Member 132923109-Jul-17 0:48
Member 132923109-Jul-17 0:48 
AnswerRe: C# Serial port data read and write Pin
Gerry Schmitz4-Jul-17 5:15
mveGerry Schmitz4-Jul-17 5:15 
mySerialPort.Read(name,0,count); //read data from serial port

The "Read" returns the number of bytes actually read (which you don't check).

You need to compare the "BytesToRead" with the number actually retrieved, and do another "Read" if all the bytes have not yet been returned (it happens).

Yes; you can use the "received" event to "receive" data asynchronously; in all my "cases" however, it never worked properly and I did my own "reading" and "timeouts". And trying to access a "single" resource like a com port asynchronously for multiple "clients" is a difficult proposition.

The "sleep" is not a problem; particularly if the device being queried requires "settling time" (like a scale).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal

GeneralRe: C# Serial port data read and write Pin
Member 132923109-Jul-17 0:46
Member 132923109-Jul-17 0:46 
AnswerRe: C# Serial port data read and write Pin
Bernhard Hiller4-Jul-17 21:38
Bernhard Hiller4-Jul-17 21:38 
GeneralRe: C# Serial port data read and write Pin
Member 132923109-Jul-17 0:47
Member 132923109-Jul-17 0:47 
Questionobject reference use else where : on application.run(new form1()) Pin
prog.sidra2-Jul-17 6:40
prog.sidra2-Jul-17 6:40 
AnswerRe: object reference use else where : on application.run(new form1()) Pin
Pete O'Hanlon2-Jul-17 7:12
mvePete O'Hanlon2-Jul-17 7:12 
AnswerRe: object reference use else where : on application.run(new form1()) Pin
Pete O'Hanlon2-Jul-17 22:42
mvePete O'Hanlon2-Jul-17 22:42 
QuestionCould not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6' Pin
jubayer1-Jul-17 23:33
jubayer1-Jul-17 23:33 
AnswerRe: Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6' Pin
Eddy Vluggen2-Jul-17 1:08
professionalEddy Vluggen2-Jul-17 1:08 
QuestionC# Color challenge Pin
BillWoodruff30-Jun-17 15:25
professionalBillWoodruff30-Jun-17 15:25 
AnswerRe: C# Color challenge Pin
Eddy Vluggen1-Jul-17 0:31
professionalEddy Vluggen1-Jul-17 0:31 
GeneralRe: C# Color challenge Pin
BillWoodruff2-Jul-17 14:53
professionalBillWoodruff2-Jul-17 14:53 
GeneralRe: C# Color challenge Pin
Eddy Vluggen3-Jul-17 23:30
professionalEddy Vluggen3-Jul-17 23:30 
GeneralRe: C# Color challenge Pin
harold aptroot2-Jul-17 2:34
harold aptroot2-Jul-17 2:34 
GeneralRe: C# Color challenge Pin
BillWoodruff2-Jul-17 14:35
professionalBillWoodruff2-Jul-17 14:35 
GeneralRe: C# Color challenge Pin
harold aptroot2-Jul-17 15:07
harold aptroot2-Jul-17 15:07 
GeneralRe: C# Color challenge Pin
BillWoodruff2-Jul-17 19:21
professionalBillWoodruff2-Jul-17 19:21 
GeneralRe: C# Color challenge Pin
Richard Deeming3-Jul-17 1:35
mveRichard Deeming3-Jul-17 1:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.