problem with AddRange and Combobox

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi,
I don't know how to specify the display and value field for a combobox
when using AddRange to fill the combo.
Here is what I have so far:


-A function to build an array of object :


Dim returnData() As Object


Do While myReader.Read()
ReDim Preserve returnData(count)
Dim currentData As New DataRecord
currentData.Display = myReader.GetValue(0).ToString


If ValueField Then
currentData.Value = myReader.GetValue(1)
End If
returnData(count) = currentData
count += 1
Loop


Return returnData


______________________________­___________________


-A function that calls the above and fills my combo


cboHeaderType.Items.AddRange(m­_queries.GetGetIdentTypes())


______________________________­____________________


The problem is that apparentely the display and value specified above
don't work and no value is selected in my combobox.


Can you help
Thx


Reply
 
Sam,

You cannot add a value to a value in the combobox.

It has to be a property from an Icollection implementing collection.

I hope this helps,

Cor
 
Thanks. This does not use AddRange. My function returns an array of
object as mentionned above. Is it not possible ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top