Click here to Skip to main content
15,845,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
what i have: data in GDV (column1, Column2)
aim: link all data present in dgv to the chart, displaying the line graph
problem: can't load the graph

What I have tried:

VB.NET
 Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ''Me.DataGridView1.Rows.Add(TextBox1.Text, TextBox1.Text * TextBox3.Text)
        Dim x As Integer = Integer.Parse(TextBox1.Text)
        Dim y As Integer = Integer.Parse(TextBox3.Text)
        Dim xy As Integer = x * y

        Me.DataGridView1.Rows.Add(x, xy)

    End Sub
  
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim data1 As Integer
        Dim data2 As Integer


        Chart1.DataSource = DataGridView1
        data1 = Me.DataGridView1.Columns(1)
        ''data2 = Me.DataGridView1.Columns(2)


        Chart1.Series("Skin Fact").Points.AddXY(data1, data2)

        Chart1.DataBind()

        ''Chart1.Series("Skin Fact").Points.AddXY(Convert.ToDouble(Column1), Convert.ToDouble(Column2))

        Chart1.Visible = True

    End Sub
End Class
Posted
Updated 8-Aug-23 4:11am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900