I tried creating an event EventLoad(true) and making the cancelbutton visible in that event , still the button did not become visible.

Pls help me out.
This is the code sample which i am using.It contains the upload process and the Event i created.
Code:
private void DoUploadProcess(string filePath)
    {
        FileStream fileToUpLoad = new FileStream(filePath, FileMode.Open, FileAccess.Read);
        int chunkSize = LoadManagerConstants.ChunkSize; //Chunk size is 532480               
        byte[] buffer = new byte[chunkSize];
        long fileSize = fileToUpLoad.Length;
        int bytesRead = fileToUpLoad.Read(buffer, LoadManagerConstants.Offset, chunkSize);//Offset=0

        this._taskId = this._workFlowProxy.BeginLoad(this._workFlowProxy.CurrentObjectClassID);
        this._statusProgressBar.Value = LoadManagerConstants.InitialValue;

        //If file to be uploaded is larger even after 6 uploads the chunk size is recalculated for the 
        //remaining uploads
        int iteration = 1;
        int preferredTransferDuration = LoadManagerConstants.PreferredTransferDuration; //PreferredTransferDuration = 2000
        int percentageOfTotalSize = LoadManagerConstants.PercentageOfTotalSize;//PercentageOfTotalSize = 1
        int bytesWritten;
        long timeForInitialChunks;
        long averageChunkTime;
        long sentBytes = 0;
        
        while (bytesRead > 0)
        {
            EventLoad.Invoke(true);
            if (gAbort) break;

            if (iteration == 1)
                this._startTime = DateTime.Now;

            bytesWritten = this._workFlowProxy.UploadChunk(this._taskId, buffer, sentBytes, bytesRead);
            if (iteration == LoadManagerConstants.AverageSample + 1)        //AverageSample = 5
            {
                timeForInitialChunks = (long)DateTime.Now.Subtract(this._startTime).TotalMilliseconds;
                averageChunkTime = System.Math.Max
                    (1, timeForInitialChunks / LoadManagerConstants.AverageSample);

                //Maximum size that can be uploaded at a time cannot be more than 4KB
                chunkSize = (int)System.Math.Min(LoadManagerConstants.MaxFileSize,
                    chunkSize * preferredTransferDuration / averageChunkTime);

                buffer = new byte[chunkSize];
            }
            sentBytes += bytesRead;

            //Retrieve and update the progress percentage of total file uploaded till now
            percentageOfTotalSize = (int)(((decimal)sentBytes / (decimal)fileSize) * 100);
            this.SetProgressStatus(percentageOfTotalSize);
            bytesRead = fileToUpLoad.Read(buffer, LoadManagerConstants.Offset, chunkSize);
            iteration++;
        }

        //Method called to inform the server file has uploaded
        bytesWritten = this._workFlowProxy.UploadChunk(this._taskId, buffer, sentBytes, bytesRead);
        fileToUpLoad.Close();
    }

 public void EventLoad()
        {
            _cancelButton.Visible = true;
            _cancelButton.Enabled = true;         
        }

Last edited by shabbir; 16Nov2006 at 21:58.. Reason: Code formating.