Reputation: 5078
I have a class i.e., a form, in C# that can be instantiated multiple times. Each time that the form is instantiated, all of its textboxes are readonly. I also have a Menubar that has an edit_button. What should happen is; when I focus on a single form and press the edit_button on the menu bar, the readonly textboxes of that particular form becomes editable but only for that form that has the focus. The rest, which does not have focus, will not be affected. I can't give a sample code because I do not know how to go about it. Can you help? Thank you.
Upvotes: 0
Views: 33
Reputation: 201
Given your description it seems the menubar is separate from all the multiple forms... is this an MDI application?
If so, in your edit button click handler, you can do something like this:
var activeForm = this.ActiveMdiChild; // assuming 'this' is the parent MDI form
foreach(var control in activeForm.Controls) {
// do something here (enable textboxes)
}
Upvotes: 1