每1秒钟更新一次DataGridView

时间:2018-08-26 14:56:56

标签: vb.net datagridview refresh fill

我试图每1秒更新一次DataGridView。 我使用了计时器,但是看到该窗体的用户界面变得非常慢。 我使用了BackgroundWorker,但没有在DataGridView中获取任何数据

这是DataGridView代码:

Private Sub OrderBookOffersForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    BackgroundWorker1.RunWorkerAsync()
End Sub

Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
    Me.OrderBookOfferBidsTableAdapter.Fill(Me.BinanceDataSet.OrderBookOfferBids)
    Me.OrderBookOfferAsksTableAdapter.Fill(Me.BinanceDataSet.OrderBookOfferAsks)
End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
    BackgroundWorker1.RunWorkerAsync()
End Sub

这是计时器代码:

Me.OrderBookOfferBidsTableAdapter.Fill(Me.BinanceDataSet.OrderBookOfferBids)
Me.OrderBookOfferAsksTableAdapter.Fill(Me.BinanceDataSet.OrderBookOfferAsks)

0 个答案:

没有答案