Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
1.80/5 (5 votes)
See more:
My problem is that I want a function of the form that is called the put disabled that and not how
nesesito help

[Edit]Code block formatting removed - ProgramFox[/Edit]


OP's additional information moved from non-solution below - Nelek
I want to create a function that detects that form has been called the function.
the purpose is to make a message box style form that only personalized and to not be copying the same form that the function call to a single form and this form sierre which was called

idk if I explain well and sorry for not tap to miss anes
Posted
Updated 2-Dec-12 11:43am
v3
Comments
Thomas Daniels 1-Dec-12 12:17pm    
What do you mean exactly?
[no name] 2-Dec-12 0:55am    
Whats your question ?? Its not a question...

1 solution

Your English doesn't make much sense, but I'll take a guess at what you mean.

If you think you need to do determine the name of the form that called your method, you have a serious design flaw.

First, doing so would couple your code directly to those forms, making it impossible to modify one without breaking the other and making it impossible to use the code in other applications or situations. For example, you're coding this method to find the name of the form class that called it, but what it you suddenly wanted to show the MessageBox from a non-Form class?? Now you're stuck...

Second, if you have functionality in that code that needs to change, based on form that called it, you're much better off putting that method code in the class for each form.

Now, in your code, you would not show the class name of the form to the user. If the MessageBox needs to show the name of a form, your form code could would normally call method that creates the MessageBox and pass in a user friendly name as a string.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900