how will a datatable be better? i don't plan to update the data, just show
it to the user. that is why i chose a datareader - they're seemingly faster
Rulin Hong wrote:
> How about putting data in a datatable first, then use invoke method.
>
> "Josh Golden" wrote:
>
>> i have a sqldatareader that could potentially pull in many rows,
>> maybe thousands, and put them into a listBox on a windows form. i
>> want to do it as fast as possible so right away i think about a new
>> thread. well scratch that, fast i can't really control. i want the
>> user interface to remain responsive during the sqldatareader load.
>> after it loads, i do this
>>
>> Do While drReader.Read
>> Me.lstValues.Items.Add(drReader.Item(0))
>> Loop
>>
>> to fill the listbox. my question is, if i load the datareader on a
>> worker thread i DO have to use the .Invoke method because this isn't
>> thread safe right? is there a better way to load the list box than
>> i am thinking?
|