S
Stephen Costanzo
I have:
Public Class test
Private displayValue As String
Private dbType As Integer
Property Display() As String
Get
Return displayValue
End Get
Set(ByVal value As String)
displayValue = value
End Set
End Property
Property DataType() As Integer
Get
Return dbType
End Get
Set(ByVal value As Integer)
dbType = value
End Set
End Property
Public Sub New(ByVal dspl As String, ByVal dt As Integer)
Display = dspl
DataType = dt
End Sub
End Class
On the form:
Dim tests As New Generic.Dictionary(Of String, test)
{ Set the values into tests }
DataGridView1.DataSource = tests.Values
( Thought DataGridView1.Columns(0).DataPropertyName = "Display" would work
but it does not )
I have a datagridview on my form that i want to bind to this dictionary.
When using a collection I was able to do this without a problem by
specifying the properties as the DataPropertyName, however this does not
seem to work when I use the Dictionary. The Dictionary provides other
necessary benefits, which is why I switched to it from a collection.
Is there a different control I should use to display the data in a grid? Or
do I need to wrap tests into something else for the purposes of displaying
the data?
Thank you
Public Class test
Private displayValue As String
Private dbType As Integer
Property Display() As String
Get
Return displayValue
End Get
Set(ByVal value As String)
displayValue = value
End Set
End Property
Property DataType() As Integer
Get
Return dbType
End Get
Set(ByVal value As Integer)
dbType = value
End Set
End Property
Public Sub New(ByVal dspl As String, ByVal dt As Integer)
Display = dspl
DataType = dt
End Sub
End Class
On the form:
Dim tests As New Generic.Dictionary(Of String, test)
{ Set the values into tests }
DataGridView1.DataSource = tests.Values
( Thought DataGridView1.Columns(0).DataPropertyName = "Display" would work
but it does not )
I have a datagridview on my form that i want to bind to this dictionary.
When using a collection I was able to do this without a problem by
specifying the properties as the DataPropertyName, however this does not
seem to work when I use the Dictionary. The Dictionary provides other
necessary benefits, which is why I switched to it from a collection.
Is there a different control I should use to display the data in a grid? Or
do I need to wrap tests into something else for the purposes of displaying
the data?
Thank you