Hello everyone,

I am an Intern at a company and I mainly create scripts to update databases. I don't have the opportunity to do much "real" programming, hence the reason I am begging for some help :p

I am working in visual studio and my program runs great. There is one minor glitch I would like to correct. Here is the GUI:


Right now a user can proceed with running the program with no checkboxes check, or both checkboxes checked. It would be ideal for a check to be ran to make sure they have selected a checkbox, be it Live or Test, and that the user can only select one checkbox.

Anyone want to offer some tips on where I should get started? I have looked through a few threads on checkboxes, but have not found enough information to get me started.

Thanks!

Recommended Answers

All 2 Replies

the easiest and savest way would be to use Radiobuttons instead. Group them in a groupBox and the user is only able to select one of them.

the way with checkboxes u can do the following thing:

Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        CheckBox2.Checked = Not CheckBox1.Checked
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        CheckBox1.Checked = Not CheckBox2.Checked
    End Sub

but then u still have to check if one of the checkboxes is selected on the startbutton event.
my vote goes for the radiobuttons

Thanks! I took your advice and created a groupbox with Radiobuttons instead of overcomplicating it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.