Another Home work problem, but have been at it a bit so thought I would throw something up.
I have defined a custom control that has an event that is called BoolChanged that should be triggered when the bool DecimalPointAllowed is changed to false by a check box. When the event is triggered a label shoud let us know that that the "Decimal point is allowed"
The checked check box is changing the DecimalPointAlowed to false, but the even is not being triggered and the label is not changing.
This is the custom control with the event.
Here is the Check box code and label that should change upon checking the checkbox. By calling the event based on the bool value changing.
public class DoubleValueEdit : TextBox
internal delegate void MyBoolValueChanged(bool Was, string result);
internal event MyBoolValueChanged BoolChanged;
public bool DecimalPointAllowed;
string a = "a";
public double Value
if (double.TryParse(Text, out Val))
Text = value.ToString();
if ((DecimalPointAllowed = true) && (BoolChanged != null))
public partial class Form1 : Form
private void doubleValueEdit1_TextChanged(object sender, EventArgs e)
dvLabel.Text = doubleValueEdit1.Value.ToString();
doubleValueEdit1.BoolChanged += new DoubleValueEdit.MyBoolValueChanged(doubleValueEdit1_BoolChanged);
void doubleValueEdit1_BoolChanged(bool Was, string result)
result2 = Was.ToString() + result + "Decimal Point Allowed";
private void ChBoolValCheckBox_CheckedChanged(object sender, EventArgs e)
doubleValueEdit1.DecimalPointAllowed = false;