View Single Post
  #5 (permalink)  
Old January 23rd, 2008, 10:17 AM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

You should use:


there is no SelectedText property.

Also, I would change this:
Dim obj as Object
Dim name as String
name = Convert.ToString(obj)


Dim name as String = lstIPC.SelectedValue or
Dim name as String = lstIPC.SelectedItem.Text

since, in either case, the return type is string you do not need to convert it.

The reason for your error, I imagine, is as Gonzalo orginally said. By Binding the list as you have you have probably only populated the string portion of the listitems and not the values.

To change that do something like:
lstIPC.DataTextField = "somecolumninyourdatasource"
lstIPC.DataValueField = "somecolumninyourdatasource"
lstIPC.DataSource = ds


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Reply With Quote