ErrorInvalidContext Problem using thread

Jan 23 at 9:21 PM
Hello,

There is some problem that I cannot solve. Problem appears when trying to copy data to GPU:

CudaDeviceVariable<float> DATA_ON_DEVICE;
float[] DATA = new float {1,2,3};
DATA_ON_DEVICE = DATA; <--- Problem Here when sending data.

Using these lines simple by pressing some Button, everything working fine.

But when using this code in thread, then it does not:

CudaDeviceVariable<float> DATA_ON_DEVICE;
    private void Thread()
    {     
   float[] DATA = new float {1,2,3};
   DATA_ON_DEVICE = DATA; 
   }      
public void button11_Click(object sender, EventArgs e)
    {            
        Thread t = new Thread(Thread);
        t.Start();
    }
Error type is shown below.. but is not clear how to solve it:

case CUResult.ErrorInvalidContext:
message = "This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had cuCtxDestroy() invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). See cuCtxGetApiVersion() for more details.";
break;