M
Mats Boberg
Hi,
I have a Dialog with a button. When you click the button a new dialog opens.
Why does the GotFocus event happens when the dialog is created(see code
below)?
/Mats.
/// <summary>
/// addItemButton click event
/// </summary>
/// <definition>[C#]
/// private void addItemButton_Click(
/// object sender,
/// System.EventArgs e
/// )
/// </definition>
/// <created>2003-03-27</created>
/// <author>MBo</author>
/// <param name="sender">Provided by framework</param>
/// <param name="e">Provided by framework</param>
private void addItemButton_Click(object sender, System.EventArgs e) {
try {
//show waitcursor
Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
// Add item to items list and trolly
AddItemForm addItemForm = new AddItemForm();
<------------------------------------------------ GotFocus event
addItemForm.WorkCard = workCard;
// Hide form from running programs
this.Text = "";
// Show form as a dialog
addItemForm.ShowDialog();
// show form in running programs
this.Text = WPAClientCommon.LangResourceManager.GetString("WorkOrderForm");
//clear
addItemForm.Dispose();
addItemForm = null;
} catch (Exception ex) {
// Log error
MessageBox.Show(WPAClientCommon.LangResourceManager.GetString("Error_Msg_Ser
iousError"),WPAClientCommon.LangResourceManager.GetString("Error_Msg_Header"
), MessageBoxButtons.OK, MessageBoxIcon.Hand,
MessageBoxDefaultButton.Button1);
// Hide messagebox faster
Application.DoEvents();
}
}
--
Mats Boberg
Regfellow
Kattsundsgatan 12:5tr
21126 Malmö
Tele: +46 40 611 48 20
Mob: + 46 70 486 87 57
I have a Dialog with a button. When you click the button a new dialog opens.
Why does the GotFocus event happens when the dialog is created(see code
below)?
/Mats.
/// <summary>
/// addItemButton click event
/// </summary>
/// <definition>[C#]
/// private void addItemButton_Click(
/// object sender,
/// System.EventArgs e
/// )
/// </definition>
/// <created>2003-03-27</created>
/// <author>MBo</author>
/// <param name="sender">Provided by framework</param>
/// <param name="e">Provided by framework</param>
private void addItemButton_Click(object sender, System.EventArgs e) {
try {
//show waitcursor
Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
// Add item to items list and trolly
AddItemForm addItemForm = new AddItemForm();
<------------------------------------------------ GotFocus event
addItemForm.WorkCard = workCard;
// Hide form from running programs
this.Text = "";
// Show form as a dialog
addItemForm.ShowDialog();
// show form in running programs
this.Text = WPAClientCommon.LangResourceManager.GetString("WorkOrderForm");
//clear
addItemForm.Dispose();
addItemForm = null;
} catch (Exception ex) {
// Log error
MessageBox.Show(WPAClientCommon.LangResourceManager.GetString("Error_Msg_Ser
iousError"),WPAClientCommon.LangResourceManager.GetString("Error_Msg_Header"
), MessageBoxButtons.OK, MessageBoxIcon.Hand,
MessageBoxDefaultButton.Button1);
// Hide messagebox faster
Application.DoEvents();
}
}
--
Mats Boberg
Regfellow
Kattsundsgatan 12:5tr
21126 Malmö
Tele: +46 40 611 48 20
Mob: + 46 70 486 87 57