Example #1
0
        //Shows the chart of a selected stock in the timescale of .
        private void maxbtn_Click(object sender, EventArgs e)
        {
            // Return the stock quote data in XML format.
            string symbols = txtSymbol.Text.Trim();

            if (symbols == null)
            {
                return;
            }
            else
            {
                try
                {
                    // Display stock charts.
                    // Use a random number to defeat cache.
                    Random random = new Random();

                    ChartImg.Load("http://chart.finance.yahoo.com/c/my/" + symbols + "?" + random.Next());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #2
0
        private void GetQuotesBtn_Click(object sender, EventArgs e)
        {
            q_symbol = txtSymbol.Text;
            if (q_symbol.Trim() != "")
            {
                try
                {
                    // Return the stock quote data in XML format. [GetQuote(q_symbol.Trim());]
                    String arg = q_symbol.Trim();
                    if (arg == null)
                    {
                        return;
                    }


                    // Display stock charts.
                    String[] symbols = q_symbol.Replace(",", " ").Split(' ');
                    // Loop through each stock
                    for (int i = 0; i < symbols.Length; ++i)
                    {
                        if (symbols[i].Trim() == "")
                        {
                            continue;
                        }
                        // If index = -1, the stock symbol is valid.
                        // Use a random number to defeat cache.
                        Random random = new Random();
                        //possibly edit this to display a varierty of forms of charts.
                        ChartImg.Load("http://ichart.finance.yahoo.com/b?s=" + symbols[i].Trim().ToUpper() + "&" + random.Next());
                    }
                }
                catch (Exception ex)
                {
                    // Handle exceptions
                    MessageBox.Show(ex.Message);
                }
            }
        }