2 Replies - 1366 Views - Last Post: 04 February 2011 - 01:56 AM Rate Topic: -----

#1 NightsEvil  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 85
  • Joined: 23-May 10

how can i get around Error No overload for method 'Start' take

Posted 04 February 2011 - 01:28 AM

So i'm having a problem with the arguments on this code where i have a place holder {1} for the string "tempDrive" but when its written like this:
            string tempFolder = System.Environment.GetEnvironmentVariable("SystemDrive");
            string tempDrive = System.Environment.GetEnvironmentVariable("TargetDrive");
            string executableDirectoryName = Path.GetDirectoryName(Application.ExecutablePath);
            System.Diagnostics.Process defrag2 = System.Diagnostics.Process.Start(tempFolder + "\\" + "AusLogics_Defrag" + "\\" + "cdefrag.exe", "-dt -o {1}", tempDrive);


it gives me the error "No overload for method 'Start' takes 3 arguments" so what can i do get past this and use both sets of arguments? Also am i using the placeholder thing correctly?

Is This A Good Question/Topic? 0
  • +

Replies To: how can i get around Error No overload for method 'Start' take

#2 fromTheSprawl  Icon User is offline

  • Monomania
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,056
  • Joined: 28-December 10

Re: how can i get around Error No overload for method 'Start' take

Posted 04 February 2011 - 01:35 AM

I don't know but shouldn't Start take the argument as one line only? instead of ',' replace them with '+' to make a single string.
Try:

tempFolder + "\\" + "AusLogics_Defrag" + "\\" + "cdefrag.exe"+ "-dt -o {1}"+ tempDrive

This post has been edited by fromTheSprawl: 04 February 2011 - 01:36 AM

Was This Post Helpful? 0
  • +
  • -

#3 CodingSup3rnatur@l-360  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 992
  • View blog
  • Posts: 972
  • Joined: 30-September 10

Re: how can i get around Error No overload for method 'Start' take

Posted 04 February 2011 - 01:56 AM

You need to use String.Format() on the second method arguement. Process.Start() doesn't automatically allow for placeholders:

System.Diagnostics.Process defrag2 = System.Diagnostics.Process.Start(tempFolder + "\\" + "AusLogics_Defrag" + "\\" + "cdefrag.exe", String.Format("-dt -o {1}", tempDrive));



This post has been edited by CodingSup3rnatur@l-360: 04 February 2011 - 02:19 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1