Hello, I hope you are doing fine.
I have expirienced a problem when trying to populate a combobox with objects.
I created the following class:
Public Class Pintura
Public M_Product As String
Public M_Formula As String
Sub New()
M_Product = ""
M_Formula = ""
End Sub
Sub New(ByVal T As String, ByVal V As String)
M_Product = T
M_Formula = V
End Sub
Public Property Product() As String
Get
Return M_Product
End Get
Set(ByVal value As String)
M_Product = value
End Set
End Property
Public Property Formula() As String
Get
Return M_Formula
End Get
Set(ByVal value As String)
M_Formula = value
End Set
End Property
End Class
Then I'm trying to populate a simple combobox with Pintura Objects:
Public Sub Load()
ComboBox1.Items.Add(New Pintura("Andres", "1"))
ComboBox1.Items.Add(New Pintura("Veronica", "2"))
With ComboBox1
.DisplayMember = "M_Product"
.ValueMember = "M_Formula"
End With
End Sub
When I run the aplication the combobox populates but displays the object type for each of the lines i added above. The combobox displays GenerarOp.Pintura.
Can someone help me with this problem?
regards.
I have expirienced a problem when trying to populate a combobox with objects.
I created the following class:
Public Class Pintura
Public M_Product As String
Public M_Formula As String
Sub New()
M_Product = ""
M_Formula = ""
End Sub
Sub New(ByVal T As String, ByVal V As String)
M_Product = T
M_Formula = V
End Sub
Public Property Product() As String
Get
Return M_Product
End Get
Set(ByVal value As String)
M_Product = value
End Set
End Property
Public Property Formula() As String
Get
Return M_Formula
End Get
Set(ByVal value As String)
M_Formula = value
End Set
End Property
End Class
Then I'm trying to populate a simple combobox with Pintura Objects:
Public Sub Load()
ComboBox1.Items.Add(New Pintura("Andres", "1"))
ComboBox1.Items.Add(New Pintura("Veronica", "2"))
With ComboBox1
.DisplayMember = "M_Product"
.ValueMember = "M_Formula"
End With
End Sub
When I run the aplication the combobox populates but displays the object type for each of the lines i added above. The combobox displays GenerarOp.Pintura.
Can someone help me with this problem?
regards.