thanks for the info. Here is what I was doing.
Dim objds1 As New DataSet
objds1 = objService.GetEmployeeList
With Me.ListBox2
.DataSource = objds1.Tables("EmployeeList")
.DisplayMember = "vcFirstName"
.ValueMember = "intTblEmployeeId"
End With
does that makes sense that selectdvalue would not show up.
I used this based off what you gave me.
Dim dr As DataRow = CType(Me.ListBox2.SelectedItem, DataRowView).Row
Dim value As String = CType(dr.Item("vcFirstName"), String)
and that does give me the data back.. now on to anotehr problem with
this. I'm using Listbox2_selectedindexchanged. when the form goes to
load, it hits this indexchanged once for each row. Is this expected
behavior. I don't want it to be looking at the change in index until
someone clicks on the listbox.
hope you are willing to give a little more info. What you gave me
will work, i just don't understand why the selectedvalue didn't
On Wed, 17 Mar 2004 12:53:56 -0800, "Alex Feinman [MVP]"
<(E-Mail Removed)> wrote:
>If you have specified DisplayMember and ValueMember, then you can use
>SelectedValue property
>In any case the SelectedItem property gives you access to the underlying
>datarow:
>
>Dim dr as DataRow = CType(listbox.SelectedItem, DataRowView).Row
>Dim ID as Integer = CInt(dr.Item("ID")) ' Presuming your dataset has a filed
>called ID
>
>"Shannon Ramirez" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> I'm working with a databound listbox. Data comes up i the list box,
>> but my problem happens when I go to selected something from that list
>> box. a listbox.selecteditem returns me the primary key value from the
>> column specified in the .valuemember. but when I do a
>> listbox.selectedvalue I don't get anything back. I get this
>>
>> {System.Data.DataRowView}
>> [System.Data.DataRowView]: {System.Data.DataRowView}
>>
>> I tried doing what I've done before when not working on a ce,
>> selectedvalue.text but that doesn't work on the compact .net
>>
>> can someone please help me out
>>
>> thanks
>> shannon
>
|