B
Bob Graham
'create object array
Dim jobnums(1000)
Omitted: code that retrieves job numbers (integers) from sql server to put in a combobox
I have a combobox (cbJob) that I want to put these values into. If I read them in from a SqlDataReader it takes
an eternity, about 7 seconds to accomplish. But if I read them into an array, it takes no measurable time.
Then I add the array items to the combobox all at once with the ..AddRange method of the combobox thus:
cbJob.Items.AddRange(jobnums)
This also takes no measurable time, and works fine.
My question is, how should I alter this so I can turn Option Strict back on?
Option strict requires a type declaration when declaring the array:
'So:
Dim jobnums(1000) as Integer
And then you can't assign the array to the .Addrange method, because the combobox wants objects, not integers.
Is there a syntax for Ctype(???) that works to convert as array of integers to objects?
Thanks, Bob Graham
Dim jobnums(1000)
Omitted: code that retrieves job numbers (integers) from sql server to put in a combobox
I have a combobox (cbJob) that I want to put these values into. If I read them in from a SqlDataReader it takes
an eternity, about 7 seconds to accomplish. But if I read them into an array, it takes no measurable time.
Then I add the array items to the combobox all at once with the ..AddRange method of the combobox thus:
cbJob.Items.AddRange(jobnums)
This also takes no measurable time, and works fine.
My question is, how should I alter this so I can turn Option Strict back on?
Option strict requires a type declaration when declaring the array:
'So:
Dim jobnums(1000) as Integer
And then you can't assign the array to the .Addrange method, because the combobox wants objects, not integers.
Is there a syntax for Ctype(???) that works to convert as array of integers to objects?
Thanks, Bob Graham