hi all
i try to send data into Thread function - the data is : string[][] DataTimes
but i get eror!!!

this my function that Start the Thread:

Thread newThread = new Thread(Form1.PlayTheClock);
            newThread.Start(DataTimes);

that the Thread Function:

public static void PlayTheClock(string[][] DataTimes)
        {
......
}

the problem is : Error 1 The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)' has some invalid arguments

thanks...

First question, you start thread with

newThread.Start(DataTimes)

Where is DataTimes defined?

If no parameters to pass:

//1. way:
 new Thread(new ThreadStart(MethodNoParams)).Start();//calling new method

//2. longer way (if you need a "t" variable maybe):
Thread t = new Thread(new ThreadStart(MethodNoParams)); //calling new method
t.Start();

If parameters to pass:

object obj ="some param";
Thread t1 = new Thread(new ParameterizedThreadStart(MethodWithParams)); //calling new method
t1.Start(obj);

MethodNoParams is a method that accepts no parameters, while MethodWithParams is a method which accpets parameter.
Just for your knowledge:

private void MethodNoParams()
        { 
        
        }

        private void MethodWithParams(object args)
        { 
        
        }

hi thanks
but i dont know how to convert (string[][] DataTimes) to (Object)
and (Object) to (string[][] DataTimes).

You literally just did it in that post. =p (Object)DataTimes (String[][])args

wooow thanks mann that wooorrkkk!!!

thx Ketsuekiame.
I wasnt around this morning...

I am glad it does.
bye.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.