Re: Selected Item in ListBox
- From: EdwardH <EdwardH@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 14:52:00 -0700
Many thanks, I realise I need the continuity of a Dataset. I have not
Datasets for a while, could you point me to a good article?
"Stan" wrote:
On 30 Mar, 19:07, EdwardH <Edwa...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
I am filling a ListBox from a stored proc and a SQLDataReader which works fine.
Private pCateg As SqlCommand
Private pDR as Data.Sql.SqlDataReader
pCateg = New SqlCommand("pLodge")
pCateg.CommandType = Data.CommandType.StoredProcedure
pDR = pCateg.ExecuteReader
ListBox1.DataSource = pDR
ListBox1.DataTextField = "Category"
ListBox1.DataValueField = "Category"
ListBox1.Databind
I am trying to use the Value/Text of the Selected Item but am failing to get
that value which is coming back as a Null:
ListBox1. SelectedValue
How should I test that an Item has been selected and then get the value for
further use?
With thanks
You are using the wrong type of object as a DataSource (It should
throw an exception).
Recommend a DataSet (one created in the App_Code folder as an XSD
file). Create a TableAdapter that uses the "pLodge" stored procedure
as its select command.
- References:
- Selected Item in ListBox
- From: EdwardH
- Re: Selected Item in ListBox
- From: Stan
- Selected Item in ListBox
- Prev by Date: Re: Selected Item in ListBox
- Next by Date: Setting ReportViewer Chart properties programaticaly
- Previous by thread: Re: Selected Item in ListBox
- Next by thread: Re: Selected Item in ListBox
- Index(es):
Relevant Pages
|