//function to load stock symbol on button click private void button2_Click(object sender, EventArgs e) { ServiceReference1.ServiceClient sc = new ServiceReference1.ServiceClient(); String sym = StockSymbol.Text; if (sym != "") { String SymResult = sc.getStockquote(sym); if (Convert.ToDouble(SymResult) == 0.00) { label2.Text = "Please Enter a Valid Symbol"; } else { label2.Text = SymResult; } } else { label2.Text = "Please Enter a Symbol"; } }
//function to load stock symbol on Enter private void StockSymbol_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToInt32(e.KeyChar) == 13) { ServiceReference1.ServiceClient sc = new ServiceReference1.ServiceClient(); String sym = StockSymbol.Text; if (sym != "") { String SymResult = sc.getStockquote(sym); if (Convert.ToDouble(SymResult) == 0.00) { label2.Text = "Please Enter a Valid Symbol"; } else { label2.Text = SymResult; } } else { label2.Text = "Please Enter a Symbol"; } } }