External componenet has thrown an exception.

  • Thread starter Thread starter Doug Bratton
  • Start date Start date
D

Doug Bratton

HELP! OK. I have a Windows form with a tab control. On one of the tab
control tab pages, I have an panel.

On this panel I am dynamically creating a variable number of customized
Buttons based on stored records from a database.

For each button, I am over-riding the MouseUp like so to open a Dialog
Window... after I close the dialog, it throws an exception... Any ideas???:

private void roomButton_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
foreach(RoomButton button in panel1.Controls)
{
if (button.Focused)
{
if (e.Button == MouseButtons.Left)
{
AddRoom addRoom = new AddRoom(this, button.ARoom);
addRoom.ShowDialog(this);
}
}
}
}
 
Solved. I had to switch the displaying of the dialog to using the Show()
method instead of the ShowDialog(this) method.
 
Back
Top