下面是我已经使用了大约两个星期的代码,我认为我一直在工作,直到我输入最后一个信息(MyClient 类),现在我在 Process.Start(url); 说找不到指定的文件。我尝试将其设置为“iexplorer.exe”以使其为 URL 加载 IE,但没有任何变化。
public partial class Form1 : Form
{
List<MyClient> clients;
public Form1()
{
InitializeComponent();
clients = new List<MyClient>();
clients.Add(new MyClient { ClientName = "Client 1", UrlAddress = @"http://www.google.com" });
BindBigClientsList();
}
private void BindBigClientsList()
{
BigClientsList.DataSource = clients;
BigClientsList.DisplayMember = "ClientName";
BigClientsList.ValueMember = "UrlAddress";
}
private void BigClientsList_SelectedIndexChanged(object sender, EventArgs e)
{
MyClient c = BigClientsList.SelectedItem as MyClient;
if (c != null)
{
string url = c.ClientName;
Process.Start("iexplorer.exe",url);
}
}
}
class MyClient
{
public string ClientName { get; set; }
public string UrlAddress { get; set; }
}
}