[Question] Listbox and button. menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Neth'zul's Avatar Banned
    Reputation
    204
    Join Date
    Nov 2007
    Posts
    887
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Question] Listbox and button.

    I have NOT been able to freaking figure this out lol.

    Lets say I have a List Box and a button. Is there any way of selecting something from the box AND clicking the generate so you get want you want.

    If you don't get me lol then here, I want to make a key gen for shitz and giggles.
    Code:
    Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
            If ListBox1.SelectedItem = "1503 A.D.: A New World" Then
                Dim key As Integer
                key = Int(Rnd() * 10)
                Select Case key
                    Case 1
                        TextBox1.Text = "5447-7278892-7648258-2126"
                    Case 2
                        TextBox1.Text = "9750-0553133-8300899-5758"
                    Case 3
                        TextBox1.Text = "2012-1236143-5723266-5867"
                    Case 4
                        TextBox1.Text = "3475-0914223-0632734-6745"
                    Case 5
                        TextBox1.Text = "9385-8677964-7296207-4572"
                End Select
    I got that but I want it so that you select, lets say CoD4, then you press Generate THEN it generates the code, not when you click on an Item in the List Box. get meh? lol.

    +rep for help.

    [Question] Listbox and button.
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just put that code in your button1_OnClick event handler?

    Also I suggest changing it to a combo box, so you can just check via index, instead of an unsafe typecast.

  3. #3
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't mean a Key generator; You mean a Key distributor. This would not generate keys, just distribute keys.

    Also, use a Combo box.. This though is what I think you mean to do; Handle the selection under a BUTTON.click not the List box.click, Your sub is

    Private Sub ListBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox.Click

    This should be under a button handle like such..

    Private Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button.Click

    Notice where Button_Click is just the identifier of the Sub and does not matter unless it's conflicting; But the Handle must be handling your ButtonName.Click
    Last edited by suicidity; 09-27-2008 at 12:26 AM.


  4. #4
    Neth'zul's Avatar Banned
    Reputation
    204
    Join Date
    Nov 2007
    Posts
    887
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a bunch guys.

    Edit: sorry apoc gotta spread rep around.

    And would it be like this?
    If ComboBox1.SelectedItem = "1503 A.D.: A New World" And Button1.Click Then
    Last edited by Neth'zul; 09-27-2008 at 11:12 AM.

  5. #5
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Erm... no.

    Double click Button1 to create the Button1_OnClick event handler.

    Then just put your code in there. (Again, use a combo-box instead of listbox if at all possible. Or just check via index instead.)

  6. #6
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apoc's dead on ^^.

    Instead of double clicking on your list-box in your form designer, double click your button.


  7. #7
    Neth'zul's Avatar Banned
    Reputation
    204
    Join Date
    Nov 2007
    Posts
    887
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea, I got it guys, thanks a bunch!

Similar Threads

  1. [Question] Noggit and me
    By Demonshade in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 12-03-2007, 07:22 PM
  2. [Question] Upper And Lower Torso Issue
    By Xcynic in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 10-14-2007, 08:35 AM
  3. [Question] sound and changable hair
    By ovre in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 10-07-2007, 06:37 PM
  4. Question: TOS and Model Changing
    By Sergioz in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 07-22-2007, 05:25 PM
  5. [Question] Action and change of race ?
    By Werteur in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 06-06-2007, 06:20 AM
All times are GMT -5. The time now is 02:39 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search