
Signature
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/
Ok, i already did, but does DataSource/DisplayMember/ValueMember also work
with a DataReader?
Guy
> "Guy Dillen" <guy_dillen@nospam.hotmail.com> schrieb:
>>I would like using a DataReader to fille a listbox with descriptions, on
[quoted text clipped - 4 lines]
> Take a look at the control's 'DisplayMember', 'ValueMember', and
> 'DataSource' properties.
Nicola - 04 Dec 2004 13:35 GMT
I don't think it's possible, but why use DataReader ???
I implemented it filling a table, added to a DataSet through a DataAdapter:
Dim DS as DataSet
Dim N as string="TableName"
Dim SQL as string="SELECT * FROM ..."
Dim CN as New SQLConnection(ConnectionString)
Dim CMD As New SqlCommand(SQL, CN), DA As New SqlDataAdapter(CMD)
DS.Tables.Add(N) : DA.Fill(DS.Tables(N))
ListBox.ValueMember = ID
ListBox.DisplayMember = Description
ListBox.DataSource = DS.Tables(N)
ListBox.SelectedIndex = -1 : ListBox.SelectedIndex = -1
I hope this can help You
nq
> Ok, i already did, but does DataSource/DisplayMember/ValueMember also work
> with a DataReader?
[quoted text clipped - 9 lines]
> > Take a look at the control's 'DisplayMember', 'ValueMember', and
> > 'DataSource' properties.