2014-02-19 45 views
-2

我需要我的程序幫助! 這裏有一些錯誤圖片: http://gyazo.com/98c1c7928d7f2d28404d884b35d79426無效的表達式'}'

請幫幫我!

謝謝!

代碼:

public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     InitializeComponent(); 
    } 

    private void Form1_Load(object sender, EventArgs e) 
    { 

    } 

    private void button7_Click(object sender, EventArgs e) 
    { 
     Assembly asm = Assembly.GetExecutingAssembly(); 
     string ver = asm.FullName; 
     string number, link; 
     number = webBrowser1.Document.GetElementById("number").GetAttribute("https://www.dropbox.com/home/Thin%20Mints?select=Verison.txt"); 
     link = webBrowser1.Document.GetElementById("link").GetAttribute("value"); 
     if (number == ver) 
      MessageBox.Show("Thin Mints is up to date!"); 
     else 
      System.Diagnostics.Process.Start(https://dl-web.dropbox.com/get/Thin%20Mints/Thin%20Mints%20v2.rar?_subject_uid=269202413&w=AAAASfY9pz0ue_YbjXxaNHFQ4g5EGHokTzlRpAGlFrKIsQ&dl=1);  
    } 
} 
+3

您提供給'System.Diagnostics.Process.Start'的網址不會引用自己... –

回答

1

你的問題就在這裏:

System.Diagnostics.Process.Start(https://dl-web.dropbox.com/get/Thin%20Mints/Thin%20Mints%20v2.rar?_subject_uid=269202413&w=AAAASfY9pz0ue_YbjXxaNHFQ4g5EGHokTzlRpAGlFrKIsQ&dl=1); 

你需要把字符串中的引號的參數(C#不會承認任何字符串作爲String除非它用引號括起來):

System.Diagnostics.Process.Start("https://dl-web.dropbox.com/get/Thin%20Mints/Thin%20Mints%20v2.rar?_subject_uid=269202413&w=AAAASfY9pz0ue_YbjXxaNHFQ4g5EGHokTzlRpAGlFrKIsQ&dl=1"); 
0

URL中的

System.Diagnostics.Process.Start(https://dl-web.dropbox.com/get/Thin%20Mints/Thin%20Mints%20v2.rar?_subject_uid=269202413&w=AAAASfY9pz0ue_YbjXxaNHFQ4g5EGHokTzlRpAGlFrKIsQ&dl=1); 

未被括在引號中。

3

Process.Start以字符串作爲輸入。在這裏你直接傳遞原始文本,沒有任何引號。因爲你的URL中包含//,地址被視爲註釋,弄亂你的右括號);

只是包括一些引號:

Process.Start("https://dl-web.dropbox.com/get/Thin%20Mints/Thin%20Mints%20v2.rar?_subject_uid=269202413&w=AAAASfY9pz0ue_YbjXxaNHFQ4g5EGHokTzlRpAGlFrKIsQ&dl=1");