|
-
Dec 3rd, 2009, 12:59 PM
#1
Thread Starter
New Member
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.
-
Dec 3rd, 2009, 01:45 PM
#2
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:
If CheckBox1.Checked = True Then
MessageBox.Show("checked")
Else
MessageBox.Show("unchecked")
End If
-
Dec 3rd, 2009, 02:20 PM
#3
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 -
-
Dec 3rd, 2009, 02:27 PM
#4
Thread Starter
New Member
Re: Validate combo box when click on button
 Originally Posted by stanav
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|