Results 1 to 4 of 4

Thread: Keep track clicks on button in another form

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    5

    Keep track clicks on button in another form

    I'm working on a project which has 4 combo boxes.
    Each of them has a drop down list of numbers from 0 to 9.

    How do I validate if each combo box is selected with one number when I click on a button?

    Is validating a checkbox the same way as validating combo box?

    Thank you.
    Last edited by sinjok; Dec 3rd, 2009 at 04:24 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Validate combo box when click on button

    If something in the combo is selected, it will be in its text property so you could check to see whether that is empty or not.

    Checkboxes have a "Checked" property
    vb.net Code:
    1. If CheckBox1.Checked = True Then
    2.       MessageBox.Show("checked")
    3. Else
    4.       MessageBox.Show("unchecked")
    5. End If

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Validate combo box when click on button

    On form load, you set the combobox.selectedIndex property of all 4 comboboxes to -1.
    In your button click event handler, you read the combobox.selectedindex of the 4 above mentioned comboboxes, and if any of them is < 0, that combobox is not yet selected by the user.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    5

    Re: Validate combo box when click on button

    Quote Originally Posted by stanav View Post
    On form load, you set the combobox.selectedIndex property of all 4 comboboxes to -1.
    In your button click event handler, you read the combobox.selectedindex of the 4 above mentioned comboboxes, and if any of them is < 0, that combobox is not yet selected by the user.
    Thanks for your reply.

    I have another question: For a lottery program, I like to keep track how many the user has played the game.
    The main form where the user needs to click on a button called "PLAY" to proceed the game.
    I have another new form that will keep track numbers of game he/she has played (I'd like to show the numbers of game in a label).
    Last edited by sinjok; Dec 3rd, 2009 at 04:25 PM.

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