Kerry Moorman
1/31/2008 7:14:00 PM
mcotter,
Use the listbox's SelectedValue property,
Kerry Moorman
"mcotter@frontiernet.net" wrote:
> Thanks. Your code works, however, how do I return the Primary Key,
> pkCarID, from the list box when I select an item in the list box.
> Here is the code I am using
>
> Dim dr As SqlDataReader
> Dim dt As New DataTable
>
> cmd = conn.CreateCommand
> cmd.CommandType = CommandType.StoredProcedure
> cmd.CommandText = "Health.spSelectCarType"
>
> dr = cmd.ExecuteReader
> dt.Load(dr)
> dr.Close()
>
> lstStandard.Items.Clear()
> lstStandard.ValueMember = "pkCarID"
> lstStandard.DisplayMember = "CarType"
> lstStandard.DataSource = dt
>
> ------------------------------------------------------------
> Procedure spSelectCarType
> Select pkCarID, CarType from tblCarType
>
>