private void Picb_RefreshClick(object sender, EventArgs e) { try { FileHandling.SaveStockInformation( HtmlHandling.GetStockInformation(lbl_StockName.Text) ); } catch { MessageBox.Show("Enter a valid stock name or check internet connection"); } StockViewer _stockViewer = new StockViewer(false, lbl_StockName.Text); this.Dispose(); }
void KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { FileHandling.SaveStockInformation( HtmlHandling.GetStockInformation(txt_StockName.Text) ); StockViewer _stockViewer = new StockViewer(false, ""); this.Dispose(); } catch { MessageBox.Show("Enter a valid stock name or check internet connection"); } } }
///click event for pictures, opening interfaces void OptionSelected(object sender, EventArgs e) { switch ((sender as PictureBox).Name) { case "picb_SelectStock": { switch (MessageBox.Show("Open Existing Stock?", "StockViewer", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: { StockViewer _stockViewer = new StockViewer(false, ""); break; } case DialogResult.No: { StockViewer _stockViewer = new StockViewer(true, ""); break; } case DialogResult.Cancel: break; } break; } case "picb_DividendForecast": { DividendForecaster _dividendForecaster = new DividendForecaster(); break; } case "picb_CalculateForward": { if (dividendPrediction == null || stock == null) { MessageBox.Show("Choose a stock and enter dividends before calculating price"); return; } ForwardCalculator _forwardCalculator = new ForwardCalculator(); _forwardCalculator.Show(); break; } } }