Joe,
I think that my thought was that because you where asking it, you had not
binded data to the listbox yet.
and that as well because you where using the item.
Probably because when you use a datasource that is taken for an operation as
you do.
However to keep it in the way you did, this did work for me as well.
\\\
strTest = strTest & DirectCast(ListBox1.Items(intIndex),
DataRowView)("Name").ToString
///
("Name" is the used datamember so that you have to change for yours)
While I had expect something as
\\\
strTest = strTest & DirectCast(ListBox1.DataSource,
DataView)(intIndex)("Name").ToString
///
What works as well. For "DirectCast(ListBox1.DataSource, DataView)" you can
directly place the datasource.
I hope it helps?
Cor
"joe" <jo*@nowayjose.com>
Thank you very much! The .ToString is definitely a step in the right
direction as it's at least keeping Excel from crashing on me, but i'm
still having one problem.
When I use the .ToString, i'm returned "System.Data.DataRowView" so
i'm assuming it's because it's databound and I must somehow use a
datarowview object to access the value?
any help would be appreciated-
thanks-
joe
On Tue, 23 Nov 2004 09:55:00 +0100, "Cor Ligthert"
<no************@planet.nl> wrote:
Joe,
1) Is databinding the fastest way to load a listbox from sqlserver?
speed is crucial and I want to make sure i'm populating it the fastest
way i can
The time done with reading the rows accoording with the question what
loading of the listbox is the fastest is comparing parts of seconds with
parts of milliseconds.
2) Also, i'm having trouble getting the selected items in the
listbox.
Will simply using the Items property (with the index) not give me
access to the value?:
For intIndex = lstStatus.SelectedIndex To lstStatus.Items.Count - 1
strTest = strTest & lstStatus.Items(intIndex)
Next
Do you have Option Strict On in top of your program?
Probably you only have to add ".ToString" after that (intIndex)
I hope this helps?
Cor