Put contents of combobox into a string

  • Thread starter Thread starter Darren
  • Start date Start date
D

Darren

OK, I'm trying to read the contents of a combobox into a string called item
but I've got no idea how to loop through each item in it

Dim i As Integer
Dim item As String
For i = 0 To ComboBox1.Items.Count - 1
item = item & "|" & ComboBox1. 'What goes in here
Next i

Can any help me out please?

Thanks
 
Look at the Item collection, something like MyCombo.Items.ToString()

-Chris
 
The only option under Items(i) is:

ComboBox1.Items(i).GetType


Look at the Item collection, something like
MyCombo.Items.ToString()

-Chris


Darren said:
OK, I'm trying to read the contents of a combobox into a string
called item
but I've got no idea how to loop through each item in it

Dim i As Integer
Dim item As String
For i = 0 To ComboBox1.Items.Count - 1
item = item & "|" & ComboBox1. 'What goes in here
Next i

Can any help me out please?

Thanks
 
Darren,

All classes have a ToString method.
--
Ginny

Darren said:
The only option under Items(i) is:

ComboBox1.Items(i).GetType


Look at the Item collection, something like
MyCombo.Items.ToString()

-Chris


Darren said:
OK, I'm trying to read the contents of a combobox into a string
called item
but I've got no idea how to loop through each item in it

Dim i As Integer
Dim item As String
For i = 0 To ComboBox1.Items.Count - 1
item = item & "|" & ComboBox1. 'What goes in here
Next i

Can any help me out please?

Thanks

 
ComboBox1.Items(i).GetTypeAre you using VB?

In the options menu find text editor options for VB, and enable "Show
advanced members"

Best Regards

Sune Pedersen
 
Back
Top