Results 1 to 2 of 2

Thread: Identifying Threads by GethashCode

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Posts
    97

    Identifying Threads by GethashCode

    Hello everybody:
    I am trying to identify the threads by using the GethashCode method. I am trying to store the value of the thread in a textbox.
    But unable to display the value in the textbox.

    I hope you will be able to guide me whats wrong...

    Thanks,

    K



    for( int NumOfThds=1; NumOfThds <=100; NumOfThds++)// For loop for 100 threads
    {
    // tcpThd=new Thread(new ThreadStart(ClientProcess));
    tcpThd.Start();
    tcpThd.GetHashCode();
    Sthread= tcpThd.GetHashCode()+ "\n";
    Sthread=txtThreadCode.Text;

    }

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256

    Re: Identifying Threads by GethashCode

    Originally posted by Rahils573
    Hello everybody:
    I am trying to identify the threads by using the GethashCode method. I am trying to store the value of the thread in a textbox.
    But unable to display the value in the textbox.

    I hope you will be able to guide me whats wrong...

    Thanks,

    K



    for( int NumOfThds=1; NumOfThds <=100; NumOfThds++)// For loop for 100 threads
    {
    // tcpThd=new Thread(new ThreadStart(ClientProcess));
    tcpThd.Start();
    tcpThd.GetHashCode();
    Sthread= tcpThd.GetHashCode()+ "\n";
    Sthread=txtThreadCode.Text;

    }
    Code:
    for( int NumOfThds=1; NumOfThds <=100; NumOfThds++)// For loop for 100 threads 
    { 
    	// tcpThd=new Thread(new ThreadStart(ClientProcess));
    	tcpThd.Start();
    
    	Sthread= tcpThd.GetHashCode()+ "\n";
    	txtThreadCode.Text = Sthread; //will change on each iteration
    }
    try this. Also you might want to remove the assignment of the identity of the thread to the textbox from the for loop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width