CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    3

    Edit form control after Application::Run has been called on Form

    I'm wondering, I am able to do functions such as Form1->textBox1->Text = "Hello" in the main cpp file before Application::Run and in the header file, but how do I edit the form controls after it has been called, ie while the form is showing without using the header file?

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Edit form control after Application::Run has been called on Form

    [ moved thread ]

    I don't really understand the problem.
    You can just use the same method, so, Form1->textBox1->text = "Blabla" should still work.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Apr 2009
    Posts
    3

    Re: Edit form control after Application::Run has been called on Form

    In the main C++ file that is generated with a new windows form application, i've created a thread that runs so that I can change a text box based on socket communication (irrelevant to my problem), when I try to do Form1->textBox1->Text = "Hello" I get this error.
    Code:
    1>.\Program.cpp(19) : error C2143: syntax error : missing ';' before '->'
    1>.\Program.cpp(19) : error C2143: syntax error : missing ';' before '->'
    And line 19 is (surprise, suprise)
    Code:
    Form1->inputbox->Text = "Hello!";
    That's my problem, as you cannot do the functions I need to inside Form1.h without screwing around with the namespaces and includes which I do not want and hopefully do not need to do

  4. #4
    Join Date
    Feb 2007
    Posts
    43

    Re: Edit form control after Application::Run has been called on Form

    My guess is you forgot to close a bracket?
    Anyway, when you have a syntax error like missing ";" don't look at the line it says... start going back until you find your error.

    ***
    re: header

    I put most of my Forms programming in the header. This feels strange to me still, but it makes sense once forms start including each other, methinks. I mean event handling and all that stuff is created by VStudio in the form's header file, so must be right.
    Last edited by bennyboy2; April 29th, 2009 at 10:03 AM. Reason: addition

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured