CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Numeric Value

  1. #1
    Join Date
    Apr 1999
    Posts
    29

    Numeric Value

    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!


  2. #2
    Join Date
    Apr 1999
    Location
    Brooklyn, NY USA
    Posts
    171

    Re: Numeric Value

    Try using this:
    Private Sub Command1_Click()
    Dim strString As String
    Dim intSpace As Integer
    Dim intLength As Integer<br%2

  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Numeric Value

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured