SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to make the checkbox stays checked when double click


How to make the checkbox stays checked when double click

Author
Message
enriquezreyjoseph
enriquezreyjoseph
SSC Journeyman
SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)

Group: General Forum Members
Points: 95 Visits: 191
Hi everyone...


I believe this is not sql hehehehe...


how should i make the checkbox stays check...

This is my code....



Public Class frmTest
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



CheckBox1.CheckState = CheckState.Checked

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

If CheckBox1.Checked Then

CheckBox2.CheckState = CheckState.Unchecked
CheckBox3.CheckState = CheckState.Unchecked

End If

End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

If CheckBox2.Checked Then

CheckBox1.CheckState = CheckState.Unchecked
CheckBox3.CheckState = CheckState.Unchecked

End If

End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged

If CheckBox3.Checked Then

CheckBox1.CheckState = CheckState.Unchecked
CheckBox2.CheckState = CheckState.Unchecked

End If


End Sub
End Class



but when i try to double click the checkbox, the check is gone, it will not stay as is..

thanks...

USC CAS CHEERDANCE TEAM :-)
OCTom
OCTom
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3121 Visits: 4152
One does not double-click a check box. A single-click does the trick. Double-clicking a check box checks it then unchecks it right away.
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26038 Visits: 17528
I will go one step further and think outside the checkbox. ;-)

You seem to have 3 checkboxes that you want to allow only one of them to be selected at a time. I would suggest that you are using the wrong control here. Try using a radio button group instead. You can add a 4th option to the group for "None" which will simulate having none of them checked.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
enriquezreyjoseph
enriquezreyjoseph
SSC Journeyman
SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)

Group: General Forum Members
Points: 95 Visits: 191
OCTom (10/4/2013)
One does not double-click a check box. A single-click does the trick. Double-clicking a check box checks it then unchecks it right away.


Hi

It seems you did not get my point, I know that when you doulble click a checkbox it will be uncheck..

What i mean brothers and sisters is that, HOW TO MAKE IT STAYS CHECK EVEN IF I DOUBLE CLICK IT, IT WILL ALWAYS STAYS CHECK NOT UNCHECK!!!!!


ok?...

cheers:-)
enriquezreyjoseph
enriquezreyjoseph
SSC Journeyman
SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)

Group: General Forum Members
Points: 95 Visits: 191
Sean Lange (10/4/2013)
I will go one step further and think outside the checkbox. ;-)

You seem to have 3 checkboxes that you want to allow only one of them to be selected at a time. I would suggest that you are using the wrong control here. Try using a radio button group instead. You can add a 4th option to the group for "None" which will simulate having none of them checked.



Hi Sean

Yes, right before you suggested it to use radio button, i already think of it, BUT i want checkboxes to behave like radio button(thou it seem stupid but i have my own reason why i am using it)
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26038 Visits: 17528
enriquezreyjoseph (10/4/2013)
OCTom (10/4/2013)
One does not double-click a check box. A single-click does the trick. Double-clicking a check box checks it then unchecks it right away.


Hi

It seems you did not get my point, I know that when you doulble click a checkbox it will be uncheck..

What i mean brothers and sisters is that, HOW TO MAKE IT STAYS CHECK EVEN IF I DOUBLE CLICK IT, IT WILL ALWAYS STAYS CHECK NOT UNCHECK!!!!!


ok?...

cheers:-)


No need to yell. We understand what you are trying to do. The point being made is that by default a checkbox does not have a doubleclick event, mostly because it doesn't make sense for that control. You can add your own but as I stated earlier you should use radio buttons.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26038 Visits: 17528
enriquezreyjoseph (10/4/2013)
Sean Lange (10/4/2013)
I will go one step further and think outside the checkbox. ;-)

You seem to have 3 checkboxes that you want to allow only one of them to be selected at a time. I would suggest that you are using the wrong control here. Try using a radio button group instead. You can add a 4th option to the group for "None" which will simulate having none of them checked.



Hi Sean

Yes, right before you suggested it to use radio button, i already think of it, BUT i want checkboxes to behave like radio button(thou it seem stupid but i have my own reason why i am using it)


Using check boxes in this case is using the wrong tool for the job. You are making this a lot harder on yourself than you need to. Look at all the code you have already had to write just to deal with the fact that you are using a series of check boxes for a mutually exclusive decision.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87175 Visits: 45270
enriquezreyjoseph (10/4/2013)
BUT i want checkboxes to behave like radio button(thou it seem stupid but i have my own reason why i am using it)


That's generally a bad idea. Anyone who's used windows and windows applications knows how checkboxes behave. When you change that behaviour, you now have a UI that does not behave as people expect it to. They'll struggle to use it, they'll log bug reports saying that the check boxes don't behave properly, etc.

Principal of UI design - stay consistent (and that's consistent within the app and with OS outside the app)

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search