none
Enable/Disble a button in the EventHandler function of file watcher class object. RRS feed

  • Question

  • Hi all,

    I have a FileSystemwatcher to monitor a folder. However, in the eventhandler for the filesystemwatcher object, I need to disable/enable a button present in the form. However it seems the eventhandler method being static, doesn't have access to the required button. 

    The code below shows the implementation of the eventhandler for the filewatcher. 

                

     private static void watch_out_Changed(object source, FileSystemEventArgs e)
     {

                notification.Visible = true;
                notification.BalloonTipTitle = "ABC";
                notification.BalloonTipText = "blahblah";
                notification.ShowBalloonTip(3000);


                /*Parse output file to get InvoiceID and fiscalID*/
                string line, InvID = "", fiscalID = "";
                int inv_f, fid_f,count;
                inv_f = fid_f = count = 0;

                GC.Collect();
      
               -->// this is where I want to disable a button present in the form, but I'm not able to use it here <------------ 
               button1.enabled = false;      <----------doesn't work

               

    }

    Any help will be highly appreciated.

    Regards,
    Abinash.


    Thursday, June 21, 2012 10:59 AM

Answers

  • Abinash,

            This link will help you out


    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Thursday, June 21, 2012 11:02 AM

All replies