Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: WinForms Plot Pin
Ikke8-Aug-03 6:50
Ikke8-Aug-03 6:50 
GeneralRe: WinForms Plot Pin
Ista8-Aug-03 9:32
Ista8-Aug-03 9:32 
Generalversioning problem Pin
devvvy7-Aug-03 22:57
devvvy7-Aug-03 22:57 
GeneralThread doesn't start with VS .NET 2003 Pin
MeisterBiber7-Aug-03 21:52
MeisterBiber7-Aug-03 21:52 
GeneralRe: Thread doesn't start with VS .NET 2003 Pin
Rein Hillmann8-Aug-03 5:38
Rein Hillmann8-Aug-03 5:38 
GeneralMulti-Threaded Programming Pin
monrobot137-Aug-03 17:12
monrobot137-Aug-03 17:12 
GeneralRe: Multi-Threaded Programming Pin
J. Dunlap7-Aug-03 17:35
J. Dunlap7-Aug-03 17:35 
GeneralRe: Multi-Threaded Programming Pin
monrobot138-Aug-03 3:15
monrobot138-Aug-03 3:15 
Should variables I need to use in a thread be static? I ask because this is what I'm trying to do:
// In the button click event
Thread myThread = new Thread (new ThreadStart (ThreadFunc));

if (button1.Text == "Connect")
{
        // this is called
	myThread.Start ();
	button1.Text = "Disconnect";
}
else
{
	popClient.DestroyConnection ();
	button1.Text = "Connect";
        // At this point the thread still isn't started (IsAlive is false)
	myThread.Abort ();
	myThread.Join ();
}


public void ThreadFunc ()
{// How can I use "popClient" in both main() and here in the threadfunc?	
Networking.PopClient popClient = new networking.PopClient (cboServer.Text, txtUser.Text, txtPassword.Text);

	bool bConnected = popClient.CreateConnection ();

	if (!bConnected)
	{
		lblError.Text = popClient.LastError;
		return;
	}

	int count = popClient.GetMailBoxCount ();
	int size = popClient.GetMailBoxSize ();

	lblMessageCount.Text = Convert.ToString (count);
	lblQuotaUsed.Text = Convert.ToString (size);
}
Like the comment there says, how can I use the popClient variable in both main and the threadfunc? So my other question (again like the comments say) is why isn't the thread started?

Thanks again for the help

- monrobot13
GeneralRe: Multi-Threaded Programming Pin
J. Dunlap8-Aug-03 9:49
J. Dunlap8-Aug-03 9:49 
GeneralBitBlt performance in C# Pin
CyberKewl7-Aug-03 16:52
CyberKewl7-Aug-03 16:52 
GeneralRe: BitBlt performance in C# Pin
J. Dunlap7-Aug-03 17:45
J. Dunlap7-Aug-03 17:45 
GeneralRe: BitBlt performance in C# Pin
CyberKewl7-Aug-03 21:21
CyberKewl7-Aug-03 21:21 
GeneralRe: BitBlt performance in C# Pin
Ista8-Aug-03 6:26
Ista8-Aug-03 6:26 
GeneralChanging a form's title Pin
eggie57-Aug-03 15:17
eggie57-Aug-03 15:17 
GeneralRe: Changing a form's title Pin
J. Dunlap7-Aug-03 15:20
J. Dunlap7-Aug-03 15:20 
GeneralRe: Changing a form's title Pin
eggie57-Aug-03 15:30
eggie57-Aug-03 15:30 
GeneralRe: Changing a form's title Pin
Rein Hillmann7-Aug-03 21:11
Rein Hillmann7-Aug-03 21:11 
GeneralRe: Changing a form's title Pin
freshthinking8-Aug-03 0:07
freshthinking8-Aug-03 0:07 
GeneralColor or Colour Pin
totig7-Aug-03 12:23
totig7-Aug-03 12:23 
GeneralRe: Color or Colour Pin
J. Dunlap7-Aug-03 12:51
J. Dunlap7-Aug-03 12:51 
GeneralHandle mouse move events in C# Pin
sumeat7-Aug-03 9:20
sumeat7-Aug-03 9:20 
GeneralRe: Handle mouse move events in C# Pin
Nnamdi Onyeyiri7-Aug-03 11:10
Nnamdi Onyeyiri7-Aug-03 11:10 
GeneralRe: Handle mouse move events in C# Pin
sumeat7-Aug-03 11:42
sumeat7-Aug-03 11:42 
GeneralRe: Handle mouse move events in C# Pin
Ista7-Aug-03 16:08
Ista7-Aug-03 16:08 
Generalmore datagrid q's: select row & tab down Pin
mikemilano7-Aug-03 9:09
mikemilano7-Aug-03 9:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.