Results 1 to 3 of 3

Thread: [RESOLVED] How to choose a ListBox itemdata other than zero???

  1. #1

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Resolved [RESOLVED] How to choose a ListBox itemdata other than zero???

    I am writing some code, that must be able to choose a listbox item, other than zero. If it selects a listbox itemdata zero, then nothing happens. But if the user was to click on a item in that listbox, then it comes up with a messagebox saying congratulations and then ends the program.

    Thanks in advance!!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How to choose a ListBox itemdata other than zero???

    Code:
    Option Explicit
    
    Private Sub Form_Load()
      '~~~ Loading sample datas
      List1.AddItem "Contains 1"
      List1.ItemData(List1.NewIndex) = 1
      List1.AddItem "Contains 2"
      List1.ItemData(List1.NewIndex) = 2
      List1.AddItem "Contains 0"
      List1.ItemData(List1.NewIndex) = 0
      List1.AddItem "Contains 4"
      List1.ItemData(List1.NewIndex) = 4
      List1.AddItem "Contains 0"
      List1.ItemData(List1.NewIndex) = 0
      
    End Sub
    
    Private Sub List1_Click()
      If List1.ItemData(List1.ListIndex) <> 0 Then  '~~~ Check if the ItemData of selected item is not 0
        MsgBox "Congratulations !"  '~~~ If so, display the message
        Unload Me                   '~~~ Close the form
      End If
    End Sub
    ...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: How to choose a ListBox itemdata other than zero???

    I will try it!!
    And thanks for the source code, my friend!!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

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