Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How do I send messages to another form

How do I send messages to another form

Scheduled Pinned Locked Moved C#
questiontutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kayhustle
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • K kayhustle

      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

      C Offline
      C Offline
      CWIZO
      wrote on last edited by
      #2

      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!

      J K 2 Replies Last reply
      0
      • C CWIZO

        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!

        J Offline
        J Offline
        Jeff Varszegi
        wrote on last edited by
        #3

        Even better, use MVC with or without a Mediator. -Jeff here, bloggy bloggy

        1 Reply Last reply
        0
        • C CWIZO

          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!

          K Offline
          K Offline
          kayhustle
          wrote on last edited by
          #4

          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?

          H 1 Reply Last reply
          0
          • K kayhustle

            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?

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            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/Invoke FindWindow and FindWindowEx to get the window handle (HWND - represented by an IntPtr in .NET) of the control. Then you can P/Invoke SendMessage to send WM_SETTEXT to the HWND 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

            K 1 Reply Last reply
            0
            • H Heath Stewart

              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/Invoke FindWindow and FindWindowEx to get the window handle (HWND - represented by an IntPtr in .NET) of the control. Then you can P/Invoke SendMessage to send WM_SETTEXT to the HWND 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

              K Offline
              K Offline
              kayhustle
              wrote on last edited by
              #6

              Thanks alot I saw your previous post with the code. I searched for this, but I wasn't getting back results that applied to what I wanted to do, I guess the keywords I was searching for weren't specific enough. K

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups