S Smee Well-Known Member Licensed User Longtime User Jan 8, 2012 #1 I reguarly use buttons with one routine and depending on the button pressed perform an action for eg Code: Sub btnAction_Click Dim btn As Button ' use to find which button sent us here btn = Sender ' this sent us here BtnVal=btn.Tag Select BtnVal Case 0 Case 1 ......... ......... ......... End Select Is there a way to do similar with checkboxes? I want to test if a checkbox is checked or not and to be able to programatically select or unselect individual boxes but all within the one code module. Thanks for some great software Erel.
I reguarly use buttons with one routine and depending on the button pressed perform an action for eg Code: Sub btnAction_Click Dim btn As Button ' use to find which button sent us here btn = Sender ' this sent us here BtnVal=btn.Tag Select BtnVal Case 0 Case 1 ......... ......... ......... End Select Is there a way to do similar with checkboxes? I want to test if a checkbox is checked or not and to be able to programatically select or unselect individual boxes but all within the one code module. Thanks for some great software Erel.
klaus Expert Licensed User Longtime User Jan 8, 2012 #2 It's exactly the same, just replace Button by CheckBox: Code: Sub cbxSelection_CheckedChange(Checked As Boolean) Dim cbx As CheckBox ' used to find which CheckBox raised the event cbx = Sender Select cbx.Tag Case 0 Case 1 ......... ......... ......... End Select This valid for all types of views. Best regards. Upvote 0
It's exactly the same, just replace Button by CheckBox: Code: Sub cbxSelection_CheckedChange(Checked As Boolean) Dim cbx As CheckBox ' used to find which CheckBox raised the event cbx = Sender Select cbx.Tag Case 0 Case 1 ......... ......... ......... End Select This valid for all types of views. Best regards.
S Smee Well-Known Member Licensed User Longtime User Jan 8, 2012 #3 Thankyou Klaus, But how do i programatically select or unselect individual boxes? joe Upvote 0
klaus Expert Licensed User Longtime User Jan 8, 2012 #4 To do this you need to define an Array of the CheckBoxes. Then you can programaticaly get or set the checked property. CheckBoxes(0).Checked = False Have a look at chapter 10.3.3 in the Beginner's Guide. The example shown is with Buttons but the same can be done with CheckBoxes. Best regards. Upvote 0
To do this you need to define an Array of the CheckBoxes. Then you can programaticaly get or set the checked property. CheckBoxes(0).Checked = False Have a look at chapter 10.3.3 in the Beginner's Guide. The example shown is with Buttons but the same can be done with CheckBoxes. Best regards.
S Smee Well-Known Member Licensed User Longtime User Jan 14, 2012 #5 Thanks Klaus, I Did that but when i select the checkbox with the code statement Code: rbDays(0).Checked=True The checkbox status changes but the CheckedChange event does not fire if i press the checkbox manually it does fire :BangHead: Upvote 0
Thanks Klaus, I Did that but when i select the checkbox with the code statement Code: rbDays(0).Checked=True The checkbox status changes but the CheckedChange event does not fire if i press the checkbox manually it does fire :BangHead:
klaus Expert Licensed User Longtime User Jan 14, 2012 #6 Modifying the Checked property of a CheckBox in the code doesn't raise the CheckedChange event. There is no difference if they are in an array or single ones. The event is only raised when the user does change it. Best regards. Upvote 0
Modifying the Checked property of a CheckBox in the code doesn't raise the CheckedChange event. There is no difference if they are in an array or single ones. The event is only raised when the user does change it. Best regards.
A alexposta2 Member Licensed User Longtime User May 12, 2012 #7 Hi Klaus, I've tried with toggle button, but the event checked seems to raised also from code. It's possible? thank you Alessio Upvote 0
Hi Klaus, I've tried with toggle button, but the event checked seems to raised also from code. It's possible? thank you Alessio
margret Well-Known Member Licensed User Longtime User May 13, 2012 #8 The toggle button will raise the event from code while the checkbox will not Upvote 0
A alexposta2 Member Licensed User Longtime User May 13, 2012 #9 Thank you for your quick Reply Alessio Upvote 0