Whiteangel Posted October 15, 2013 at 05:40 PM Report #529080 Posted October 15, 2013 at 05:40 PM (edited) Boas pessoal, Eu quero que o meu chart me mostre dois campos de uma tabela, mas não estou a conseguir programa-lo, estou a fazer assim Const cs As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Acer\Documents\Visual Studio 2010\Projects\Empresa2\Empresa2Teste.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" Dim con As New SqlConnection(cs) con.Open() Dim novonome, novaquantidade As String Dim sql As String = "SELECT * FROM Artigod WHERE Nome='" & novonome & "', " & "Quantidade='" & novaquantidade & "'" Dim sqlcom As New SqlCommand(sql, con) Dim da As New OleDbDataAdapter(sql, con) <-- da erro de que o tipo nao esta definido Dim ds As New DataSet() da.Fill(ds, "Artigos") Dim ChartArea1 As ChartArea = New ChartArea() <-- da erro de que o tipo nao esta definido Dim Legend1 As Legend = New Legend() <-- da erro de que o tipo nao esta definido Dim Series1 As Series = New Series() <-- da erro de que o tipo nao esta definido Dim Chart1 = New DataVisualization.Charting.Chart() Me.Controls.Add(Chart1) ChartArea1.Name = "ChartArea1" Chart1.ChartAreas.Add(ChartArea1) Legend1.Name = "Legend1" Chart1.Legends.Add(Legend1) Chart1.Location = New System.Drawing.Point(50, 50) Chart1.Name = "Chart1" Series1.ChartArea = "ChartArea1" Series1.Legend = "Legend1" Series1.Name = "Series1" Chart1.Series.Add(Series1) Chart1.Size = New System.Drawing.Size(750, 500) Chart1.TabIndex = 0 Chart1.Text = "Chart1" Chart1.Series("Series1").XValueMember = "Nome" Chart1.Series("Series1").YValueMembers = "Quantidade" Chart1.DataSource = ds.Tables("Artigos") con.Close() Edited October 15, 2013 at 05:46 PM by Whiteangel
ribeiro55 Posted October 16, 2013 at 08:17 AM Report #529127 Posted October 16, 2013 at 08:17 AM (edited) Um tópico é suficiente para o problema. www.portugal-a-programar.pt/topic/62911-graficos Edited October 16, 2013 at 08:18 AM by ribeiro55 Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips"
Recommended Posts