[VC++ 2003 .NET] error C2039
-
Hallo zusammen!
Ich habe mit dem VC++ ein .NET Projekt in Managed C++ erstellt. Das lief bis gestern alles ohne Probleme.
Kurz zur Struktur: Ich habe eine MainForm und 2 zusätzliche Forms (dienen als Dialoge) erstellt. Auf der MainForm habe ich eine RichTexBox und diese wollte ich via Pointer einfach an die 2. Form im Konstuktor weiterreichen (hab ihn überladen), um dann dort Einstellungen übernehmen zu können. Aber seit dem ich das gemacht habe bekomme ich nun für jede Zeile in der Methode "InitializeComponent()" in der MainForm folgenden Fehler:
Form1.h(97) : error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
Form1.cpp(0) : see declaration of 'System::Resources::ResourceManager'
Form1.h(98) : error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
Form1.cpp(0) : see declaration of 'System::Resources::ResourceManager'
...Und das geht dann so weiter, bis er wegen zu vieler Errors abbricht. Ich hab mittlerweilen alles rückgänig gemacht (überladener Konstruktor weg, Pointer-Übergabe weg etc.) und trotzdem bekomme ich immer noch diese riesen Latte an Fehlern. Vielleicht wisst ihr ja was ich da machen kann?
Hier mal meine MainForm:
#pragma once #include "Info.h" #include "Settings.h" #include "server.h" namespace MasterChatv4 { 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 { private: System::ComponentModel::IContainer * components; //Chat-View System::Windows::Forms::Button * btSend; System::Windows::Forms::TextBox * comLine; System::Windows::Forms::TreeView * clTreeView; System::Windows::Forms::RichTextBox * chatBox; // Menubar System::Windows::Forms::GroupBox * groupBox1; System::Windows::Forms::Button * startServer; System::Windows::Forms::NotifyIcon * notifyIcon; System::Windows::Forms::Button * stopServer; System::Windows::Forms::GroupBox * groupBox2; System::Windows::Forms::Button * startClient; System::Windows::Forms::Button * stopClient; System::Windows::Forms::GroupBox * groupBox3; System::Windows::Forms::Button * search; System::Windows::Forms::GroupBox * groupBox4; System::Windows::Forms::Button * preferences; System::Windows::Forms::Button * InfoDlg; System::Windows::Forms::Button * schliessen; //StatusBar System::Windows::Forms::StatusBar * statBar; System::Windows::Forms::StatusBarPanel * statBarPan1; System::Windows::Forms::StatusBarPanel * statBarPan3; System::Windows::Forms::StatusBarPanel * statBarPan2; System::Windows::Forms::StatusBarPanel * statBarPan4; System::Windows::Forms::ImageList * imageList; //Dialogs Info *infobox; Settings *settings; void InitializeComponent(void) { this->components = new System::ComponentModel::Container(); System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(MasterChatv4::Form1)); System::Configuration::AppSettingsReader * configurationAppSettings = new System::Configuration::AppSettingsReader(); this->comLine = new System::Windows::Forms::TextBox(); this->btSend = new System::Windows::Forms::Button(); this->statBar = new System::Windows::Forms::StatusBar(); this->statBarPan1 = new System::Windows::Forms::StatusBarPanel(); this->statBarPan2 = new System::Windows::Forms::StatusBarPanel(); this->statBarPan3 = new System::Windows::Forms::StatusBarPanel(); this->statBarPan4 = new System::Windows::Forms::StatusBarPanel(); this->clTreeView = new System::Windows::Forms::TreeView(); this->imageList = new System::Windows::Forms::ImageList(this->components); this->groupBox1 = new System::Windows::Forms::GroupBox(); this->stopServer = new System::Windows::Forms::Button(); this->startServer = new System::Windows::Forms::Button(); this->notifyIcon = new System::Windows::Forms::NotifyIcon(this->components); this->groupBox2 = new System::Windows::Forms::GroupBox(); this->stopClient = new System::Windows::Forms::Button(); this->startClient = new System::Windows::Forms::Button(); this->groupBox3 = new System::Windows::Forms::GroupBox(); this->search = new System::Windows::Forms::Button(); this->groupBox4 = new System::Windows::Forms::GroupBox(); this->schliessen = new System::Windows::Forms::Button(); this->InfoDlg = new System::Windows::Forms::Button(); this->preferences = new System::Windows::Forms::Button(); this->chatBox = new System::Windows::Forms::RichTextBox(); (__try_cast<System::ComponentModel::ISupportInitialize * >(this->statBarPan1))->BeginInit(); (__try_cast<System::ComponentModel::ISupportInitialize * >(this->statBarPan2))->BeginInit(); (__try_cast<System::ComponentModel::ISupportInitialize * >(this->statBarPan3))->BeginInit(); (__try_cast<System::ComponentModel::ISupportInitialize * >(this->statBarPan4))->BeginInit(); this->groupBox1->SuspendLayout(); this->groupBox2->SuspendLayout(); this->groupBox3->SuspendLayout(); this->groupBox4->SuspendLayout(); this->SuspendLayout(); // // comLine // this->comLine->AccessibleDescription = resources->GetString(S"comLine.AccessibleDescription"); this->comLine->AccessibleName = resources->GetString(S"comLine.AccessibleName"); //Ab hier jede Zeile die "resources->GetObject" nutzt this->comLine->Anchor = (*__try_cast<__box System::Windows::Forms::AnchorStyles * >(resources->GetObject(S"comLine.Anchor"))); this->comLine->AutoSize = (*__try_cast<__box System::Boolean * >(resources->GetObject(S"comLine.AutoSize"))); //Hier geht der Code genau so weiter //und für jede Zeile der genannte Fehler... } public: Form1(void) { InitializeComponent(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Void schliessen_Click(System::Object * sender, System::EventArgs * e) { this->Close(); } System::Void InfoDlg_Click(System::Object * sender, System::EventArgs * e) { infobox = new Info(); infobox->ShowDialog(); } System::Void prferences_Click(System::Object * sender, System::EventArgs * e) { settings = new Settings(); settings->ShowDialog(); } }; }
Hoffe ihr könnt mir helfen!
-
Mach aus deinen usings mal ein #using wenn du .NET verwendest.
-
Das wird doch nur benötigt, wenn ich einen DLL über #using holen will, aber nicht für namespaces!
Edit: Habs grade getestet, aus "oder?" wird "!"
-
+push+
-
Habs gelöst!
Ich habe einfach die zusätzlichen Includes der anderen Forms und die damit Verbundenen Elemente der MainForm rausgeholt, neu kompiliert und voilá es geht. Hab danach nochmal alles neu inkludiert und seit dem läuft es. Richtig schlau gemacht hat mich das zwar trotzdem nicht, aber ich bekomm das schon noch raus.