Question Linking Checkboxes Using a ‘Set’ Button

rajiv_jolly

New member
Joined
Jun 1, 2012
Messages
3
Programming Experience
Beginner
Hi Guys,

I have created a form which contains 10 checkboxes. When checkbox 1 is selected, checkboxes 9 and 10 are automatically selected (checked) also. This link between 1, 9 and 10 has been created by manually writing the code to link these boxes.

Is there a way I can link boxes without manually having to write the link? For example, I would like to select the boxes to link and then hit a ‘Set’ button which will then automatically set/link the boxes.

My form will eventually have 100+ boxes that need linking and need to find an easier way of creating links between boxes other than manually coding the links.

Any help will be much appreciated. Thanks in advance.
 
Hi jimcilhinney,

Thank you for your reply. I am not a great programmer and would really appreciate some sample code if possible. Please see my code below. How can I modify this to perform the actions you recommended?

VB.NET:
Public Class Form1
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            CheckBox9.Checked = True
            CheckBox10.Checked = True
        Else
            CheckBox9.Checked = False
            CheckBox10.Checked = False
        End If
    End Sub
End Class
 
TBH 100 checkboxes with relationships to other controls in a single form seems excessive to me.

As for how to link them, I would do it the same as you, except I would NEVER name controls CheckBox1, CheckBox2, etc.. Saying 9 and 10 are dependant on 1 is much more confusing than chkSave and chkReset are dependant on chkStart, for example.
 
There has got to be a better way of approaching this problem than 100 checkboxes! It's not exactly going to be user friendly! Frankly, 10 is already way too many for one form. The mind simply boggles at the possibility that you really need the capability to configure different combinations running into millions!

In the example you give, is there a scenario in which 9 or 10 is checked without the other two? If not, why are 9 and 10 even necessary? If they are there merely to display additional conditions put in force by checking 1 why not use a fuller label or a tool tip or a message box?
 
Back
Top