D
dbuchanan
Hello,
Where do I put the code that adds my EventHandlers so that they do not fire
during form load?
========= Here is my code: ==========
public partial class AddEditMasterTask : bsfAddEdit
{
public AddEditMasterTask()
{
InitializeComponent();
// form title
this.Text = "";
// Title
lblDialogTitle.Text = "Add Master Task";
// Populate Dropdowns
taPhase.Fill(dataSetHipAdmin.Phase);
taMeasureDim.Fill(dataSetHipAdmin.MeasureDim);
taMeasureUnit.Fill(dataSetHipAdmin.MeasureUnit);
// Populate form
taMTask.Fill(dataSetHipAdmin.MTask);
// Disable Save button, Add Event Handlers
ButtonSettingsAndEventHandlers();
}
public void ButtonSettingsAndEventHandlers()
{
// Hide Save
this.btnSave.Enabled = false;
// TextChanged
this.descriptionTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.baseTimeTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.ordTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.contractorCommentsTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
// CheckedChanged
this.allowParticipationCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
this.allowQuantityCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
this.configuredDisplayCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
// SelectedValueChanged
this.fkMeasureDimIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
this.fkMeasureUnitIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
this.fkPhaseIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
}
public void EditsBegun(object sender, EventArgs e)
{
// Change buttons after edits begin
this.btnSave.Enabled = true;
}
===============================
The EditsBegun event fires during form load. What did I do wrong?
Doug
Where do I put the code that adds my EventHandlers so that they do not fire
during form load?
========= Here is my code: ==========
public partial class AddEditMasterTask : bsfAddEdit
{
public AddEditMasterTask()
{
InitializeComponent();
// form title
this.Text = "";
// Title
lblDialogTitle.Text = "Add Master Task";
// Populate Dropdowns
taPhase.Fill(dataSetHipAdmin.Phase);
taMeasureDim.Fill(dataSetHipAdmin.MeasureDim);
taMeasureUnit.Fill(dataSetHipAdmin.MeasureUnit);
// Populate form
taMTask.Fill(dataSetHipAdmin.MTask);
// Disable Save button, Add Event Handlers
ButtonSettingsAndEventHandlers();
}
public void ButtonSettingsAndEventHandlers()
{
// Hide Save
this.btnSave.Enabled = false;
// TextChanged
this.descriptionTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.baseTimeTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.ordTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
this.contractorCommentsTextBox.TextChanged += new
System.EventHandler(this.EditsBegun);
// CheckedChanged
this.allowParticipationCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
this.allowQuantityCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
this.configuredDisplayCheckBox.CheckedChanged += new
System.EventHandler(this.EditsBegun);
// SelectedValueChanged
this.fkMeasureDimIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
this.fkMeasureUnitIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
this.fkPhaseIDComboBox.SelectedValueChanged += new
System.EventHandler(this.EditsBegun);
}
public void EditsBegun(object sender, EventArgs e)
{
// Change buttons after edits begin
this.btnSave.Enabled = true;
}
===============================
The EditsBegun event fires during form load. What did I do wrong?
Doug