Create Various Stock Charts & CandleStick Chart in Visual Studio - C# Programming

This is a Video Tutorial to Show how to Create Various Stock Charts & CandleStick Chart in Visual Studio - C# Programming




Please Follow the Tutorial Video Properly For Database Connection in Visual Studio and Code Input Please Do Follow Below.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NiftyStockChart
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }



        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                stocksBindingSource.EndEdit();
                stocksTableAdapter.Update(database.Stocks);
                dataGridView1.Refresh();
                MessageBox.Show("your data has been successfully saved.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'database.Stocks' table. You can move, or remove it, as needed.
            this.stocksTableAdapter.Fill(this.database.Stocks);

        }

        private void btnLoad_Click(object sender, EventArgs e)
        {
            //clear grid
            chart.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineWidth = 0;
            chart.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineWidth = 0;
            //Init
            chart.Series["Daily"].XValueMember = "Day";
            chart.Series["Daily"].YValueMembers = "High,Low,Open,Close";
            chart.Series["Daily"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date;
            //chart.Series["Daily"]["OpenCloseStyle"] = "Triangle";
            chart.Series["Daily"]["ShowOpenClose"] = "Both";
            chart.DataManipulator.IsStartFromFirst = true;
            chart.DataSource = database.Stocks;
            chart.DataBind();

        }

        private void chart_Click(object sender, EventArgs e)
        {

        }
    }
}

--End of Code Input--

Copy paste the above code and enjoy the output have any doubt regarding this please do comment