In my Visual Studio project file: <TargetFramework>net6.0-windows</TargetFramework>
I have a Winforms application whose main form has two buttons, button A and button B.
I have coded button A so that it disables itself when clicked, launches form A, and when form A is closed, control returns to the button click event where button A is re-enabled:
btnA.Enabled = false;
FormA frmA = new FormA();
btnA.Enabled = frmA.ShowDialog(this) == DialogResult.OK;
However this does not allow the user to do anything on the main form until frmA is closed.
When button A is clicked, I still want to disable button A so that the user cannot open another form A. But I also want the user to be able to click button B on the main form and have that logic work the same way: disable button B, launch form B, re-enable button B.
What I am trying to do is give the user the ability to launch one form A and one form B from the main form. Can I accomplish that with the pattern I've described? If so, how? (Note: There could be buttons C and D later.) I would gladly consider a different/better approach. Thanks Hedge.