Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes within user controls, within a form!

Status
Not open for further replies.

Casbah

Programmer
May 18, 2004
31
IE
Hi, I'm having a bit of trouble with a user control I have made.
Basically each instance of this control contains a checkbox and a label etc... call it Option
Then I have a second control that is made up of a group of of these controls... call it OptionHolder
So in my form I add an OptionHolder
Then in the load method of the form i add options to the option holder...
Code:
        Dim test1 As New Option
        test1.Setup("Option1", 1)
        Me.OptionHolder1.AddOption(test2)
which calls this method of the OptionHolder class
Code:
    Sub AddOption(ByRef opOption As Option)
        Me.pnlOptions.Controls.Add(opOption)
    End Sub
which all seems to work fine. Everything shows up as it should...

Now I wanted to add some logic to the checkbox being checked/unchecked event so in the Option class I have
Code:
    Public Sub chkBxOptionName_CheckChange(ByVal sender As    System.Object, ByVal e As System.EventArgs) Handles chkBxOptionName.CheckedChanged
        If chkBxOptionName.Checked Then
            MsgBox("Checked")
        Else
            MsgBox("Unchecked")
        End If
    End Sub
When I fire up the option control on its own this works fine, and the message boxes get displayed when i check/uncheck any checkboxes.
However in the main app when I check/uncheck any of the boxes nothing happens?

I'm not sure at all what I'm doing wrong?
Any help greatly appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top