473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Value of Object dies When it exits the thread

//windows forms
//c#

UserControl1 SortzTextAndProg = new UserControl1();

public void BubleSortMethod()
{


Controls.Add(SortzTextAndProg);
SortzTextAndProg.Left = 10;
SortzTextAndProg.Top = 100;
int temp = 0, k = 1;
KindsOfSorting Obj = new KindsOfSorting();


while (Obj.NumberOfSwapzInBubble >= temp)
{
if (Obj.NumberOfSwapzInBubble == 0)
{
temp += 2;
}


Obj.BublSort(ref ArryBub);
Thread.Sleep(1000);
for (int i = 0; i < 15; i++)
{

SortzTextAndProg.rtxSortingResult.AppendText("\t" + ArryBub[k, i]);

}
/*Keep a Break Point ,U can see the values of rtxSortingResult gettinf appened*/
SortzTextAndProg.pbSortz.Step = 30;
SortzTextAndProg.pbSortz.PerformStep();
SortzTextAndProg.rtxSortingResult.AppendText("\n" + "After" + " " + temp++ + " " + "Swap" + "\n");


k++;


}

}

private void allTheSortsToolStripMenuItem_Click(object sender, EventArgs e)
{


Form1 Fobj = new Form1();
Thread ThreadBub = new Thread(new ThreadStart(Fobj.BubleSortMethod));
ThreadBub.Start();
}


in the above code for windows forms......where in
UserControl1 is a usercontrol created with a rich text box name rtxSortingResult and a progress bar name pbSortz

in my dll i have a method called BubleSortMethod
which has 2 dimentional array which is ArryBub

i create a thread for this sort

when the thread is running i can see the values of rtxSortingResult and pbSortz getting changed

after the thread is over when the control returns to the Main ........the object dies and the User control is not displaying

why is this?
Aug 28 '07 #1
0 878

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Ken Godee | last post by:
module1 calls a function in module2 module2 starts a thread that calls a function in module3 and then returns to module1 thread finishes and I need the return value from the thread to use in...
16
by: VBSome | last post by:
As far as I understand there is no native VB.NET equivalent of the VB6 Web browser control. There are some things I can play with HTML wise, but none do what I really need to do (which is...
6
by: Clark Sann | last post by:
Can someone help me understand what object should be used as the lock object? I've seen some programs that use Monitor.Enter(Me). Then, in those same programs, they sometimes use another object. ...
6
by: Sid Price | last post by:
I have been reading about the managed heap and garbage collection and I have a question. I have a class that has a very simple task and that is to send a UDP message to a remote computer. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.