uriy
uriy

Reputation: 1

Datagridview InvokeRequired works slow

I'm developing software for logging data from RS232. There is a lot of data received each millisecond. Received data is stored in datagridview, you can see on attached picture. For filling data I use dataGridView1.InvokeRequired from serialPort1_DataReceived event. It works fine when there is just a few data on RS232. But when it receives many packets from RS232 GUI is working slow. There is no reaction for buttons pressing, and application consumes CPU. Once I disconnect RS232 physically there is no new data, buttons pressing response immediately. My second approach was using dataGridView1.Rows.Add directly from serialPort1_DataReceived event. In this case it works fast, buttons are responsible. But dataGridView1 doesn't refresh, and some times flicker. I'm already using double buffering for it.

So my questions are:

  1. How to speed up using InvokeRequired?
  2. How to refresh dataGridView1 after filling dataGridView1.Rows.Add from serialPort1_DataReceived?

enter image description here

Upvotes: 0

Views: 56

Answers (0)

Related Questions