Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

checkbox modified

bodenboden Member Posts: 1
[b][red]This message was edited by boden at 2003-12-15 5:9:41[/red][/b][hr]
Hello,

I would like to have a combobox with the .modified property that the textbox has.
So in oop style i created a new class call h_checkbox which inherits checkbox and added this property as follows:

On another place in the event checkbox.SelectedIndexChanged I check the modified property and if modified is true I change the background color of the checkbox to indicate that it has been modified.

This works with a little problem. I have to press the checkbox 2 times for the background to change since the SelectedIndexChanged event fires before the Click event so the first time my check of checkbox.modified is before the Click event set modified to true.

My question is if there is any way to control the order of the events or if there is any other way to solve the same problem?

I guess I could skip the whole h_checkbox thing and save the value of checkbox.text and check it in the SelectedIndexChanged event to see if they are diffrent but my other solution felt more in style with oop programming.

Best Regards
Magnus

Code
----------------------------------------------------
public class h_CheckBox : CheckBox
{
public bool modified = false;

public h_CheckBox()
{
//
// TODO: Add constructor logic here
//
this.Click += new System.EventHandler(this.h_Click);
}

private void h_Click(object sender, System.EventArgs e)
{
this.modified = true;
MessageBox.Show( "h_Click();" );
}
}
------------------------------------------------------------------


Sign In or Register to comment.