I have a listbox and a class. The class is called CTS_Warnings_List And the listbox is called lbpropWarningFacList
Here is the class:
Public Class CTS_Warnings_List
Public _Warning As String
Public _WarnID As Integer
Public Property Warning() As String
Get
Return _Warning
End Get
Set(ByVal value As String)
_Warning = value
End Set
End Property
Public Property WarnID() As Integer
Get
Return _WarnID
End Get
Set(ByVal value As Integer)
_WarnID = value
End Set
End Property
Sub New(ByVal Warning As String, ByVal WarnID As Integer)
Me.Warning = Warning
Me.WarnID = WarnID
End Sub
End Class
So now I want to add a new item to the listbox. So I tried this:
Dim llist As New CTS_Warnings_List("K", 8)
lbpropWarningFacList.Items.Add(llist)
I also tried this:
lbpropWarningFacList.Items.Add(New CTS_Warnings_List("K", 8))
When I run the app and add these to the listbox, in each case I get this displayed in the listbox:
NameOfApplication.NameOfClass
as the display in the listbox.
What am I doing wrong?
Thank you
ToStringmethod in your class.