//输入基金代码查看某只基金详情 private void button5_Click(object sender, EventArgs e) { string str = textBox2.Text; //通过try catch把输入的基金代码转到网页,若网页不存在,则抛出错误, //同时把输入的错误基金代号的格式抛出 try { string x = wh.GetContent(@"http://fund.eastmoney.com/" + str + ".html"); x = x.Substring(x.IndexOf("<title>") + 7); x = x.Substring(0, x.IndexOf("</title>")); if (!(x.Contains(str))) { throw new Exception(); } funddetail f = new funddetail(str); f.Show(); } catch (Exception ex) { MessageBox.Show("输入错误,不存编号为" + str + "的基金。", "提示"); textBox1.Text = ""; textBox1.Enabled = true; textBox2.Enabled = true; button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button5.Enabled = true; } }
//查看某只基金详情 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { funddetail f = new funddetail(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); f.Show(); }