无效的表达式术语'}'

时间:2014-02-19 01:43:29

标签: c# term

我的程序需要帮助! 以下是错误的一些图片: 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 个答案:

答案 0 :(得分:3)

Process.Start接受一个字符串作为输入。在这里,您直接传递原始文本,没有任何引号。由于您的网址包含//,因此该地址会被视为评论并使您的大括号);混乱

只需加上一些引号:

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

答案 1 :(得分: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"); 

答案 2 :(得分:0)

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

未附在引号中。