Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep a thread going to maintain a usercontrol?

Status
Not open for further replies.

tomcoombs

Programmer
Aug 14, 2003
65
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top