Click here to Skip to main content
15,916,091 members
Home / Discussions / C#
   

C#

 
AnswerRe: Condition of C#. Pin
Richard MacCutchan7-Jun-17 22:39
mveRichard MacCutchan7-Jun-17 22:39 
AnswerRe: Condition of C#. Pin
OriginalGriff7-Jun-17 22:55
mveOriginalGriff7-Jun-17 22:55 
QuestionFetching data from multiple mailboxes Pin
Member 132459727-Jun-17 4:23
Member 132459727-Jun-17 4:23 
AnswerRe: Fetching data from multiple mailboxes Pin
OriginalGriff7-Jun-17 8:06
mveOriginalGriff7-Jun-17 8:06 
AnswerRe: Fetching data from multiple mailboxes Pin
F-ES Sitecore7-Jun-17 22:47
professionalF-ES Sitecore7-Jun-17 22:47 
GeneralRe: Fetching data from multiple mailboxes Pin
Member 113461538-Jun-17 3:52
Member 113461538-Jun-17 3:52 
QuestionMissing data on Windows App form C# Pin
Member 131317266-Jun-17 23:33
Member 131317266-Jun-17 23:33 
AnswerRe: Missing data on Windows App form C# Pin
Jochen Arndt7-Jun-17 1:46
professionalJochen Arndt7-Jun-17 1:46 
Using a timer is a bad idea. Data might get lost if there are more data send between two ticks than the internal buffer can hold (4096 bytes by default) and/or with high system load. The common method is using a thread that reads and processes incoming data (especially which high data rates like in your case). I suggest to use the BackgroundWorker Class (System.ComponentModel)[^].

However, the buffer size can be set with the SerialPort.ReadBufferSize Property (System.IO.Ports)[^].

If you still want to use a timer be aware that the smallest possible timer tick is system dependant (resolution of the system clock) which is used when passing a smaller value. The typical resolution is 15 ms.

There is also a possible buffer overflow in your code:
C#
int Bytes = serialPort1.BytesToRead;
byte[] buffer = new byte[5 * 1024];                                                                                //Byte[] buffer = new byte[Bytes];
long read = serialPort1.Read(buffer, 0, Bytes);
The commented line is doing it right.
GeneralRe: Missing data on Windows App form C# Pin
Member 131317267-Jun-17 2:47
Member 131317267-Jun-17 2:47 
GeneralRe: Missing data on Windows App form C# Pin
Gerry Schmitz7-Jun-17 3:16
mveGerry Schmitz7-Jun-17 3:16 
GeneralRe: Missing data on Windows App form C# Pin
Jochen Arndt7-Jun-17 3:26
professionalJochen Arndt7-Jun-17 3:26 
AnswerRe: Missing data on Windows App form C# Pin
Luc Pattyn8-Jun-17 13:44
sitebuilderLuc Pattyn8-Jun-17 13:44 
GeneralRe: Missing data on Windows App form C# Pin
Member 1313172611-Jun-17 20:41
Member 1313172611-Jun-17 20:41 
GeneralRe: Missing data on Windows App form C# Pin
Luc Pattyn12-Jun-17 6:15
sitebuilderLuc Pattyn12-Jun-17 6:15 
GeneralRe: Missing data on Windows App form C# Pin
Member 1313172612-Jun-17 20:39
Member 1313172612-Jun-17 20:39 
GeneralRe: Missing data on Windows App form C# Pin
Luc Pattyn12-Jun-17 23:42
sitebuilderLuc Pattyn12-Jun-17 23:42 
QuestionJson parser error when converting iphone images from bytes to base64 string in a MVC JsonResult Pin
jkirkerx6-Jun-17 10:22
professionaljkirkerx6-Jun-17 10:22 
AnswerRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx6-Jun-17 12:49
professionaljkirkerx6-Jun-17 12:49 
SuggestionRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
Richard Deeming7-Jun-17 0:57
mveRichard Deeming7-Jun-17 0:57 
GeneralRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx7-Jun-17 6:33
professionaljkirkerx7-Jun-17 6:33 
QuestionCreate a chart in PowerPoint using C#. Pin
Member 126813284-Jun-17 22:30
Member 126813284-Jun-17 22:30 
AnswerRe: Create a chart in PowerPoint using C#. Pin
OriginalGriff4-Jun-17 22:43
mveOriginalGriff4-Jun-17 22:43 
Questioncustom controls not binding wpf Pin
Member 112967764-Jun-17 7:52
Member 112967764-Jun-17 7:52 
AnswerRe: custom controls not binding wpf Pin
Gerry Schmitz5-Jun-17 5:36
mveGerry Schmitz5-Jun-17 5:36 
GeneralRe: custom controls not binding wpf Pin
Member 112967765-Jun-17 18:30
Member 112967765-Jun-17 18:30 

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.