Basic Problems with Multithreading
-
First: Its a program for university that schould show Multithreading with Windows Forms. We use: Microsoft Visual Studio 2008 C++ Windows Forms It should be a litte example how to create a thread and to change textbox text or something Here my thoughts using namespace System::Threading //including the namespace fpr threading public: delegate void UpdateDelegate(); //writing a delegate //Button to start the thread private: System::Void cmdStart_Click(System::Object^ sender, System::EventArgs^ e) { Thread^ meinThread = gcnew Thread(gcnew ThreadStart(test)); } public: void test() { Invoke(gcnew UpdateDelegate(update)); } public: void update() { txtThread->Text = "thread gestartet"; } Visual Studio shows me 2 messages "A delegator expects 2 arguments" what am i doing wrong? can u give me a basic checklist how to start a thread thats changes a textbox or something like that? Please need help .)
-
First: Its a program for university that schould show Multithreading with Windows Forms. We use: Microsoft Visual Studio 2008 C++ Windows Forms It should be a litte example how to create a thread and to change textbox text or something Here my thoughts using namespace System::Threading //including the namespace fpr threading public: delegate void UpdateDelegate(); //writing a delegate //Button to start the thread private: System::Void cmdStart_Click(System::Object^ sender, System::EventArgs^ e) { Thread^ meinThread = gcnew Thread(gcnew ThreadStart(test)); } public: void test() { Invoke(gcnew UpdateDelegate(update)); } public: void update() { txtThread->Text = "thread gestartet"; } Visual Studio shows me 2 messages "A delegator expects 2 arguments" what am i doing wrong? can u give me a basic checklist how to start a thread thats changes a textbox or something like that? Please need help .)
here is a simple recipe: 1. tell your IDE to always show line numbers; see here for Visual Studio[^]; 2. look at the file name, method name, and line number when the compiler or the run-time system generates an error or exception (in general, however not here, as you are having a compile=time problem: for run-time problems, this implies you look at Exception.ToString() and not Exception.Message) 3. that most often points you straight to the line at fault. 4. now take the error message literally, and try to apply that to the problematic line. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages