using System;
using System.Runtime.CompilerServices;
using System.Security.Policy;
namespace Plummer_Launcher
{
partial class Form1
{
/// (i skipped some of the vs generated code)
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.WebBrowser webBrowser1;
public static int updateChangelog()
{
while (true)
{
string version = comboBox1.SelectedValue.ToString();
string res = "https://skmedix.pl/minecraft-changelog/" + version;
System.Uri uri = new System.Uri(res);
webBrowser1.Url = uri;
}
return 0;
}
updateChangelog();
}
}
这是我的代码。问题是 - 当我进行更改时,我会遇到更多错误。我只是认为我做不到正确的...我希望代码每次版本combobox1 中的值发生变化时都更改url 代码。我做错了什么?
我尝试使用异步无效。
您有随机的
#endregion
,但没有相应的#region
- 删除它
您在班级层面上称呼
updateChangelog
,这是不对的。您希望在组合框值更改时调用该函数。
订阅 ComboBox 的更改事件以处理更改,处理程序方法内的代码应该是:
string version = comboBox1.SelectedValue.ToString();
string res = "https://skmedix.pl/minecraft-changelog/" + version;
System.Uri uri = new System.Uri(res);
webBrowser1.Url = uri;