I created a user control with two checkboxes on it. I added mouse down event handlers to prevent both checkboxes from being checked at the same time.
The constructor for the user control takes an argument that is used to set the fontsize of the control by passing it back to the base class.
I created an overloaded contructor that allows the control to be instantiated with or without passing the fontsize argument. If the control is instantiated without an argument, the constructor calls the other constructor with a default value for the argument.
The checkbox event handlers are added in the constructor that accepts an argument. If I instantiate the control by passing an argument (ie going directly through the constructor that adds the event handlers), then the control works as planned, and the checkbox mousedown event handlers work. If I instantiate the control without passing an argument and go through the constructor that calls the constructor that adds the handlers, then the event handlers do not work.
I am not sure why the event handlers are not being added when I go through the argument-less constructor. I would appreciate any help figuring this out. Thanks.
Public Class DigitalIn
Private Sub YesBox_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If NoBox.Checked = True Then
NoBox.Checked = False
Private Sub NoBox_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If YesBox.Checked = True Then
YesBox.Checked = False
Public Sub New()
Public Sub New(ByVal locFS As Double)
' This call is required by the Windows Form Designer.
' Add any initialization after the InitializeComponent() call.
AddHandler YesBox.MouseDown, AddressOf YesBox_MouseDown
AddHandler NoBox.MouseDown, AddressOf NoBox_MouseDown