If I understand you correctly you can you a custom class like so:
add items like this:
cbo.Items.Add(New ListBoxItem(MyObject, "display string"))
retrieve items like this:
Dim MyObject as Object = CType(cbo.SelectedItem, ListBoxItem).Data
Public Class ListBoxItem
Private listItemData As Object
Private listItemText As String
' This is what is displayed in the ComboBox drop-down
Public Overrides Function ToString() As String
Return listItemText
End Function
Public Sub New(ByVal itemData As Object, ByVal itemText As String)
listItemData = itemData
listItemText = itemText
End Sub
Public ReadOnly Property Data() As Object
Get
Data = listItemData
End Get
End Property
Public ReadOnly Property Text() As String
Get
Text = listItemText
End Get
End Property
End Class
HTH,
Greg
[quoted text, click to view] "Mendhak" <anonymous@discussions.com> wrote in message
news:eZZtI$hpEHA.1308@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> When you add an object to a combobox, and run the application, you'll get
> something like this:
>
> System.Windows.Forms.Button, Text: Button1
>
> (for example).
>
> Is it possible to have just the text/value in the object to be displayed
> in
> the combobox, yet at the same time when retrieving the combobox item,
> getting that same object back?
>
> In this particular case, an object of ANY type can be added to the
> combobox.
>
> TIA.
>
>