How do I send messages to another form
-
I want to know how to send data from one form to another? Like lets say I want my program to put data in the textbox of another form, how would I go about doing this? Thanks, K
This was anwserd so many times in thsi forum ... Search a little. But the idea is to pass a refrence of the form with the textvox to the form that wants to change that textbox in the constructor. Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
-
This was anwserd so many times in thsi forum ... Search a little. But the idea is to pass a refrence of the form with the textvox to the form that wants to change that textbox in the constructor. Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
Even better, use MVC with or without a Mediator. -Jeff here, bloggy bloggy
-
This was anwserd so many times in thsi forum ... Search a little. But the idea is to pass a refrence of the form with the textvox to the form that wants to change that textbox in the constructor. Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
-
Thanks, but what if I didn't create the class for the textbox I want to send to. For example, if I wanted to send info to a text box in a web browser, where I can start the process with the Process class, but how would I access a reference to it?
That's been answered many times as well. You need to get a handle to the process (see the
System.Diagnostics.Process
class in the .NET Framework SDK) then P/InvokeFindWindow
andFindWindowEx
to get the window handle (HWND
- represented by anIntPtr
in .NET) of the control. Then you can P/InvokeSendMessage
to sendWM_SETTEXT
to theHWND
with the text you want to set. Search this forum for more information, and see the Platform SDK for details. Previous experience with Windows messaging will definitely be a plus.Microsoft MVP, Visual C# My Articles
-
That's been answered many times as well. You need to get a handle to the process (see the
System.Diagnostics.Process
class in the .NET Framework SDK) then P/InvokeFindWindow
andFindWindowEx
to get the window handle (HWND
- represented by anIntPtr
in .NET) of the control. Then you can P/InvokeSendMessage
to sendWM_SETTEXT
to theHWND
with the text you want to set. Search this forum for more information, and see the Platform SDK for details. Previous experience with Windows messaging will definitely be a plus.Microsoft MVP, Visual C# My Articles