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. textbox trouble

textbox trouble

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
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.
  • U Offline
    U Offline
    User 625201
    wrote on last edited by
    #1

    I'm not sure haow to qualify the textbox-append statement. The following statement: myapp1::Form1::ioBOX.Appendtext("x"); Gives this error: error C2228: left of '.Appendtext' must have class/struct/union type type is '' ---------------------------------------------------------------------- Any ideas? ---------------------------------------------------------------------- //MY CODE - error near bottom #pragma once extern "C" int magiccalc(void); namespace myapp1 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public __gc class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); magiccalc(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::TextBox * ioBOX; private: void InitializeComponent(void) { this->ioBOX = new System::Windows::Forms::TextBox(); ... ...yadda yadda } public: static void TOioBox(int outnum) { ERROR----> myapp1::Form1::ioBOX.Appendtext("x"); } }; } extern "C" { void showme(int wrapnum) // My wrapper for C { myapp1::Form1::TOioBox(3); } } Thanks

    M S 2 Replies Last reply
    0
    • U User 625201

      I'm not sure haow to qualify the textbox-append statement. The following statement: myapp1::Form1::ioBOX.Appendtext("x"); Gives this error: error C2228: left of '.Appendtext' must have class/struct/union type type is '' ---------------------------------------------------------------------- Any ideas? ---------------------------------------------------------------------- //MY CODE - error near bottom #pragma once extern "C" int magiccalc(void); namespace myapp1 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public __gc class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); magiccalc(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::TextBox * ioBOX; private: void InitializeComponent(void) { this->ioBOX = new System::Windows::Forms::TextBox(); ... ...yadda yadda } public: static void TOioBox(int outnum) { ERROR----> myapp1::Form1::ioBOX.Appendtext("x"); } }; } extern "C" { void showme(int wrapnum) // My wrapper for C { myapp1::Form1::TOioBox(3); } } Thanks

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You'd need to use an instance of Form1, not the class itself, because ioBOX is an instance member. Your syntax would probably look something like:

      pForm1->ioBOX->AppendText( S"x" );

      Note that C++ is case-sensitive and that the AppendText method takes a System::String*. Stability. What an interesting concept. -- Chris Maunder

      1 Reply Last reply
      0
      • U User 625201

        I'm not sure haow to qualify the textbox-append statement. The following statement: myapp1::Form1::ioBOX.Appendtext("x"); Gives this error: error C2228: left of '.Appendtext' must have class/struct/union type type is '' ---------------------------------------------------------------------- Any ideas? ---------------------------------------------------------------------- //MY CODE - error near bottom #pragma once extern "C" int magiccalc(void); namespace myapp1 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public __gc class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); magiccalc(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::TextBox * ioBOX; private: void InitializeComponent(void) { this->ioBOX = new System::Windows::Forms::TextBox(); ... ...yadda yadda } public: static void TOioBox(int outnum) { ERROR----> myapp1::Form1::ioBOX.Appendtext("x"); } }; } extern "C" { void showme(int wrapnum) // My wrapper for C { myapp1::Form1::TOioBox(3); } } Thanks

        S Offline
        S Offline
        Signal 9
        wrote on last edited by
        #3

        try: this->ioBox->AppendText() DO NOT USE THE dot operator (.) since you are using a pointer you must use the -> operator.

        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