I am using this this to start a thread, but when it has added the usercontrol to the panel, I *think* the thread ends. How can I get the thread to stay running and run the user control in a sep thread (like inheriting from CWndThread in C++) ????
Code:
Thread firstThread = new Thread( new ThreadStart( ChannelThreadEntry ));
firstThread.Start();
}
}
}
public void ChannelThreadEntry()
{
GeevsTestApp.UserControl1 testchannelControl = new GeevsTestApp.UserControl1();
Invoke(new SayHiDelegate(SayHi), new object [] {testchannelControl });
}
private void SayHi(UserControl1 msg)
{
msg.propChannelName="New";
msg.Location = new System.Drawing.Point(nextChanPos, 0);
nextChanPos = nextChanPos +202;
Chans[ChanCount] = msg;
this.ChannelPanel.Controls.Add(Chans[ChanCount]);
Chans[ChanCount].DragEnter += new System.Windows.Forms.DragEventHandler(this.user1_DragEnter);
Chans[ChanCount].DragDrop += new System.Windows.Forms.DragEventHandler(this.user1_dragDrop);
Chans[ChanCount].Changed += new UserControl1.ChangedEventHandler(ChanChanged);////////////here is the problem HELP :TODO HERE:
Chans[ChanCount].LineChanged += new UserControl1.LineEventHandler(UserControl1_LineChanged);
//Chans.ucEditBox1.userControl31.BarChanged += new UserControl3.BarEventHandler(UserControl3_BarChanged);
ChanCount++;
}
Thanks
Tom
Code:
Thread firstThread = new Thread( new ThreadStart( ChannelThreadEntry ));
firstThread.Start();
}
}
}
public void ChannelThreadEntry()
{
GeevsTestApp.UserControl1 testchannelControl = new GeevsTestApp.UserControl1();
Invoke(new SayHiDelegate(SayHi), new object [] {testchannelControl });
}
private void SayHi(UserControl1 msg)
{
msg.propChannelName="New";
msg.Location = new System.Drawing.Point(nextChanPos, 0);
nextChanPos = nextChanPos +202;
Chans[ChanCount] = msg;
this.ChannelPanel.Controls.Add(Chans[ChanCount]);
Chans[ChanCount].DragEnter += new System.Windows.Forms.DragEventHandler(this.user1_DragEnter);
Chans[ChanCount].DragDrop += new System.Windows.Forms.DragEventHandler(this.user1_dragDrop);
Chans[ChanCount].Changed += new UserControl1.ChangedEventHandler(ChanChanged);////////////here is the problem HELP :TODO HERE:
Chans[ChanCount].LineChanged += new UserControl1.LineEventHandler(UserControl1_LineChanged);
//Chans.ucEditBox1.userControl31.BarChanged += new UserControl3.BarEventHandler(UserControl3_BarChanged);
ChanCount++;
}
Thanks
Tom