Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to make the checkbox stays checked when double click Expand / Collapse
Author
Message
Posted Thursday, October 3, 2013 11:13 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, October 21, 2013 3:10 AM
Points: 79, 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
Post #1501421
Posted Friday, October 4, 2013 11:44 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, October 17, 2014 12:32 PM
Points: 2,598, Visits: 3,933
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.
Post #1501714
Posted Friday, October 4, 2013 11:53 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, October 17, 2014 2:15 PM
Points: 13,077, Visits: 12,523
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 Moden's 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)
Post #1501719
Posted Friday, October 4, 2013 6:22 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, October 21, 2013 3:10 AM
Points: 79, 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
Post #1501803
Posted Friday, October 4, 2013 6:26 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, October 21, 2013 3:10 AM
Points: 79, 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)
Post #1501806
Posted Monday, October 7, 2013 7:31 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, October 17, 2014 2:15 PM
Points: 13,077, Visits: 12,523
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 Moden's 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)
Post #1502122
Posted Monday, October 7, 2013 7:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, October 17, 2014 2:15 PM
Points: 13,077, Visits: 12,523
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 Moden's 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)
Post #1502124
Posted Monday, October 7, 2013 7:36 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:17 AM
Points: 40,159, Visits: 36,546
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 2008, MVP
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

Post #1502129
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse