我有一個類,其中包含從數據流中填充數據的列表。我想將該列表綁定到datagridview,以便它自動填充列表。然而,當數據進入時,這個列表並不令人耳目一新。我有類似的東西。綁定列表(的類)datagridview在vb.net
Public class MyClass
Private mData as list(Of networkData)
Public Property Data() as list(Of networkData)
Get
return mData
End Get
Set
mData = value
End Set
End Property
' some other properties that aren't imporant
' stuff to load Data with data from network stream
end class
Public class networkDat
Private rawdata as string
Public Property rawdata() as string
Get
return mrawdata
End Get
Set
mrawData = value
End Set
End Property
' some other properties that aren't imporant
' functions to parse rawdata into the other properties
End Class
'form
Public Class dataviewer
Dim dataView as datagridViewer = new datagridviewer()
Private Sub dataviewer_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dim x as myClass = new myClass() 'new will start the datastream
datagridview.datasource = x.Data
End Sub
自從我啓動數據流後,第一個數據查看器將具有一組初始數據。但它不會隨着新數據的更新而更新。
@LarsTech我更新了我的列表到綁定列表,它似乎工作。如果您將您的評論更改爲答案,我可以將其標記爲已回答並給予您信任。現在我只需要解決我的線程問題! – BinaryDuck