错误1运算符'> ='无法应用于'方法组'和'方法组'类型的操作数

时间:2014-12-07 23:56:03

标签: c#

我需要帮助以解决错误(请参阅标题)所有帮助。我浏览了很多其他人的错误,但似乎没有人解决它,如果代码格式不正确,我很抱歉

public void button11_Click(object sender, EventArgs e)
{
    string weight = (ExtractNumbers(webBrowser1.Document.GetElementsByTagName("table")[2].GetElementsByTagName("td")[11].InnerText));
}

public void webBrowser3_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    string salesrate = (ExtractNumbers(this.webBrowser3.Document.GetElementsByTagName("table")[2].GetElementsByTagName("td")[17].InnerText)); 
}

public void timer9_Tick(object sender, EventArgs e)
{
    *if (weight >= salesrate)
    {
        i am getting this error with this IF statement
    }*
}

public static string salesrate(string expr)
{
    return string.Join(null, Regex.Split(expr, ""));
}

public static string weight(string expr)
{
    return string.Join(null, Regex.Split(expr, ""));
}

1 个答案:

答案 0 :(得分:0)

根据您发布的代码,以下是更改

string weight= "";
string salesrate = "";


public void button11_Click(object sender, EventArgs e)
{
    weight = (ExtractNumbers(webBrowser1.Document.GetElementsByTagName("table")[2].GetElementsByTagName("td")[11].InnerText));
}

public void webBrowser3_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    salesrate = (ExtractNumbers(this.webBrowser3.Document.GetElementsByTagName("table")[2].GetElementsByTagName("td")[17].InnerText)); 
}

public void timer9_Tick(object sender, EventArgs e)
{
    try {
      var parsedSalesRate = Double.parse(salesrate);
      var parsedWeight = Double.parse(weight);
      if(parsedWeight >= parsedSalesRate) {
          // ...
      }
    } catch(Exception ex) {
           throw;
    }
}



        public static string GetSalesrate(string expr)
        {
            return string.Join(null, Regex.Split(expr, ""));

        }
        public static string GetWeight(string expr)
        {
            return string.Join(null, Regex.Split(expr, ""));

        }