Results 1 to 5 of 5

Thread: List box problems

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    List box problems

    When i have a value like Spade12 and Club1 in a list box, how do i make it so its just 12, or 1?

    Thank you i advance
    ILMV

  2. #2
    Addicted Member
    Join Date
    May 2005
    Posts
    168

    Re: List box problems

    Hi,

    Not great but you can use:

    VB Code:
    1. Dim CardVal As String
    2.    
    3. CardVal = List1.List(List1.ListIndex)
    4. CardVal = Replace(CardVal, "Spade", "")
    5. CardVal = Replace(CardVal, "Club", "")
    6. CardVal = Replace(CardVal, "Diamond", "")
    7. CardVal = Replace(CardVal, "Heart", "")
    Have a good one!
    BK

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: List box problems

    Bit of tweaking needed but worked like a charm, i thank you.

  4. #4
    Hyperactive Member
    Join Date
    May 2005
    Posts
    324

    Re: List box problems

    A tiny detail, but wouldn't

    VB Code:
    1. Dim CardVal As String
    2.    
    3. CardVal = Replace(Replace(Replace(Replace(List1.List(List1.ListIndex), "Spade", ""), "Club", ""), "Diamond", ""), "Heart", "")

    be quicker?

  5. #5
    Addicted Member
    Join Date
    May 2005
    Posts
    168

    Re: List box problems

    Hi,

    Anguswalker:

    No, there wouldn;t be any difference since the replace() is called the same number of times. It is only harder to read on one line. <g> You could always stick some timing code for each method and compare for yourself.

    Have a good one!
    BK

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