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 / C++ / MFC
  4. C++ control textBox of Form1 and Form2

C++ control textBox of Form1 and Form2

Scheduled Pinned Locked Moved C / C++ / MFC
c++mysqlhelptutorial
3 Posts 3 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.
  • H Offline
    H Offline
    HeeMongKorea
    wrote on last edited by
    #1

    Hi.
    I send a "TEXT" from Form1 to Form2.
    Sometimes it's good, sometimes it's not good.
    When you send "TEXT" from Form1 to Form2, TEXT disappears from Form2.show.

    Hide Expand Copy Code
    Form1.h

    private Burron1()

    {

    Form2::Form fm;

    fm.viewText();
    

    }

    Form2.h
    namespace Form {
    public class Form
    {
    Form2()
    {
    void viewText();
    }
    }
    }

    void viewText()
    {
    textBox1->Text="TEXT";
    }

    Only when Text's Form, no problem. I cann't see other , only did mySql. This disappeared the "TEXT". textBox->Text is a Empty. I sent "TEXT" can't look for any.

    I want to know how to make the appearing thing.
    Say me , please.
    Thank you.

    L V 2 Replies Last reply
    0
    • H HeeMongKorea

      Hi.
      I send a "TEXT" from Form1 to Form2.
      Sometimes it's good, sometimes it's not good.
      When you send "TEXT" from Form1 to Form2, TEXT disappears from Form2.show.

      Hide Expand Copy Code
      Form1.h

      private Burron1()

      {

      Form2::Form fm;

      fm.viewText();
      

      }

      Form2.h
      namespace Form {
      public class Form
      {
      Form2()
      {
      void viewText();
      }
      }
      }

      void viewText()
      {
      textBox1->Text="TEXT";
      }

      Only when Text's Form, no problem. I cann't see other , only did mySql. This disappeared the "TEXT". textBox->Text is a Empty. I sent "TEXT" can't look for any.

      I want to know how to make the appearing thing.
      Say me , please.
      Thank you.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      private Burron1()
      {
      Form2::Form fm;
      fm.viewText();
      }

      You create a local instance of Form2 in the above method, and then call viewText. But as soon as you return from that method, the variable fm goes out of scope and the form is destroyed. You need to create the form outside this method so it remains active until you decide to destroy it.

      1 Reply Last reply
      0
      • H HeeMongKorea

        Hi.
        I send a "TEXT" from Form1 to Form2.
        Sometimes it's good, sometimes it's not good.
        When you send "TEXT" from Form1 to Form2, TEXT disappears from Form2.show.

        Hide Expand Copy Code
        Form1.h

        private Burron1()

        {

        Form2::Form fm;

        fm.viewText();
        

        }

        Form2.h
        namespace Form {
        public class Form
        {
        Form2()
        {
        void viewText();
        }
        }
        }

        void viewText()
        {
        textBox1->Text="TEXT";
        }

        Only when Text's Form, no problem. I cann't see other , only did mySql. This disappeared the "TEXT". textBox->Text is a Empty. I sent "TEXT" can't look for any.

        I want to know how to make the appearing thing.
        Say me , please.
        Thank you.

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        Is it a native or managed c++ code? :confused:

        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