I realise this topic has been covered before,
but i am struggling to grasp the concept of delegates and stuff.
my program has a multi lines textbox, and a function (which runs on a different thread) that runs in a loop continuesly receiving data from a socket. this data comes in the form of a string, and it is made into a system.string, and is then appended to the textbox
the problem i am having is that the textbox is created on thread1, where has the function is on thread2. trying to access the textbox from thread 2 makes baby jesus cry. I understand that this is where i need to use the invoke methods, and delegate functions, but as to implimenting these processing to solve my delema is still beyond my grasp.
i can show you what i have so far in terms of relevant code
public ref class Form1 : public System::Windows::Forms::Form
{
using namespace System::Runtime::InteropServices;
recvStr.append("\r\n");
System::String^ ms;
ms = Marshal::PtrToStringAnsi(static_cast<IntPtr>(const_cast<char *>(recvStr.c_str())));
Bookmarks