Click to See Complete Forum and Search --> : Numeric Value


Federica Pavese
August 17th, 1999, 10:07 AM
I have a ComboBox with names and codes. For example:
Brazil 1
USA 2
Italy 3
...

I want to take just the number to each item.
I have used the Val function, but this work just when the number is first. For example: 1 Brazil.
What can I do?
Thanks in advance!

Vlad Chapranov
August 17th, 1999, 10:45 AM
Try using this:
Private Sub Command1_Click()
Dim strString As String
Dim intSpace As Integer
Dim intLength As Integer<br%2

Lothar Haensler
August 17th, 1999, 10:53 AM
I suggest you use the Itemdata property of the combobox.
cmb.additem "brasil"
cmd.itemdata(cmd.newindex) = 1
and so on

That way you can easily extract the numbers by just accesssing the itemdata-property of the current item.