Visual C++ Error C2146

耗尽温柔 提交于 2019-12-25 03:28:24

问题


everyone, I was trying to compile a program using C++/CLI to check my stocks, but I ran into an error when I put the variable in the URL. Can anyone help me, please?

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
    this->webBrowser1->Navigate("http://finance.yahoo.com/echarts?s="num".HK+Interactive#chart1:symbol="num".hk;range=1d;indicator=volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source=undefined");
}

Oh, and by the way, this code is from a "Windows Forms Application" and the name of the variable is "num". Again, I would appreciate any help if possible. Thanks.


回答1:


It looks like you aren't doing anything to build the string. I've never done managed C++, but I assume you can't do this: "http://finance.yahoo.com/echarts?s="num and get what you want. In C#, you could just use operator+: "http://finance.yahoo.com/echarts?s=" + num, or use StringBuilder, or String.Format. I'd imagine there's something similar in managed C++.



来源:https://stackoverflow.com/questions/5783048/visual-c-error-c2146

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!