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. Windows Forms
  4. Basic Problems with Multithreading

Basic Problems with Multithreading

Scheduled Pinned Locked Moved Windows Forms
tutorialcsharpc++visual-studiowinforms
2 Posts 2 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.
  • P Offline
    P Offline
    pascal lisewski
    wrote on last edited by
    #1

    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 .)

    L 1 Reply Last reply
    0
    • P pascal lisewski

      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 .)

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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


      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