textbox trouble
-
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
-
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
You'd need to use an instance of
Form1
, not the class itself, becauseioBOX
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 -
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