functions not working in Vista while in windows it goes smoothly.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smish
    New Member
    • Jan 2007
    • 51

    functions not working in Vista while in windows it goes smoothly.....

    Hi,

    I am starting a process which is an excel file.what it does is opens the excel file with the data content on the click of a button .now when i again click this or another button which uses this file m not able to delete it n gets the message file in use..so i found out another method whose code snippet is given below.First i start the process then i kill it if the process if already running..but the problem am facing is in Vista it gives the error when i try to kill the process saying the file is in use..In windows xp it works smoothly..

    Please its urgent..waitign for reply..


    Code:
    buton1click()
    {
    process = Process.Start(excelFilePath4Cal);//excelFilePath4Cal..its an excel file which has the data from the datagrid
    }
    
    
    buton2click()
    {
    if (process != null)
                        {
                            process.Kill();
                       }
    }

    thanx..
    Last edited by tlhintoq; Feb 25 '09, 08:51 PM. Reason: [CODE] ... your code goes here [/CODE] tags added
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    This may be because your application is running under limited user... You will have to run your program as administrator ...

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      wrap your attempt to kill the process in a try...catch block this way the exception will be handled, even if the handling is to do nothing.

      Comment

      • PRR
        Recognized Expert Contributor
        • Dec 2007
        • 750

        #4
        what i meant was, Vista runs all programs under "limited user" (programs don't have rights to do anything malicious) ... if your program need admin privileges you need to run it as administrator.. ..

        Comment

        Working...