I realise this might be hard to explain, so let me start by using an example from Windows; keBugCheckEx().
How would I go about making a method that is contained within one program but, when executed from another, affect the program it is in. For example, in the main program, you could have:
public static void Panic(uint errCode)
{
System.Windows.MessageBox.Show("Function Panic() was called with error code: "
+ errCode);
Application.Exit();
}
And then, in the second program, you could call that method, e.g.
public static void Main(string[] args)
{
Foo.Panic(0x3C);
}
How would I go about making it so that, instead of the MessageBox showing in the second program, it appears in the first program? Sorry if this is not very well explained.
You mention two separate “programs”. Do you mean two separate executables? I think what you mean is you would have a project that is more of a class library that encapsulates certain functions / validations. You refer to “Foo” but no other declaration… is it a second project within your overall application “Solution” and included as part of the main with #using. Secondary class libraries SHOULD be able to do a simple messagebox as long as its called from within the overall main UI thread.
You might need to elaborate a bit more / update your question.
I guess the final solution was the feedback comment to have the class just have a method within the class that does nothing but pass a string message BACK to the calling source. From that, any application calling it can get the message and display it within their own UI thread.