Selected List Value as Object
Posted on 2013-11-19
I don't even know the correct terminology for this, so I will try to explain.
I have a list box that I populate with values from an object (Item), one object per row.
Now I want to select and use the value in that row to pass it as a reference to the object in another method.
Private Sub xyz
' declare the variable
Dim thing As Thing
Dim addThing As AnotherThing
' I get an error with this:
getThing = lstThing.SelectedValue.ToString
addThing = _Machine.doSomething(getThing)
Trying to pass the object associated with getThing to addThing, but get an error "Value of Type String cannot be converted..."
VB suggests using cType to convert, but that doesn't work either.
I know it's something very elementary, but I can't figure it out!