hi friends!
I need to know how to create a graph in vbasic. please send the syntax.possible with eg.
I also need to know how to link one form with another.
Thanks in advance.
elanch

Hi,

USe MSChart Control For the Graph.
U can also use Crystal Reports
Build Graph on Data stored in Database
To Show Another Form use :

Form2.Show

REgards
Veena

HI,

I wants to create line graph using ms chart in vb6 form. can i know how to pass the values to chart without using database. if i know any sample code is better, thank you.

Try to use this sample code

To use this sample, please following steps

Create a new project in VB6
Pull down the Project menu and choose Components .
Select the checkbox next to Microsoft ChartControl 6.0(OLEDB), Click OK.
Add a combobox,one Mschart control and one check box tothe existing form.
Paste in the following code tothe code window

Private Sub Form_Load()
'Fill the combo box with different types of chart types.
With Combo1
.AddItem "3D Bar"
.AddItem "2D Bar"
.AddItem "3D Line"
.AddItem "2D LIne"
.AddItem "3D Area"
.AddItem "2D Area"
.AddItem "3D Step"
.AddItem "2D Step"
.AddItem "3D Combination"
.AddItem "2D Combination"
End With
'Declare 2D array to store values for the chart
'Variant ----so that can store both text as well as numbers
Dim X(1 To 7, 1 To 6) As Variant
 
X(1, 2) = "Steel"
X(1, 3) = "Aluminium"
X(1, 4) = "Copper"
X(1, 5) = "Buxite"
X(1, 6) = "Lead"
 
X(2, 1) = "JAN"
X(2, 2) = 2
X(2, 3) = 3
X(2, 4) = 4
X(2, 5) = 5
X(2, 6) = 6
 
X(3, 1) = "FEB"
X(3, 2) = 4
X(3, 3) = 6
X(3, 4) = 3
X(3, 5) = 10
X(3, 6) = 18
 
X(4, 1) = "MAR"
X(4, 2) = 1
X(4, 3) = 3
X(4, 4) = 8
X(4, 5) = 7
X(4, 6) = 9
 
X(5, 1) = "APR"
X(5, 2) = 4
X(5, 3) = 6
X(5, 4) = 13
X(5, 5) = 10
X(5, 6) = 12
 
X(6, 1) = "MAY"
X(6, 2) = 2
X(6, 3) = 9
X(6, 4) = 9
X(6, 5) = 12
X(6, 6) = 7
 
X(7, 1) = "JUN"
X(7, 2) = 13
X(7, 3) = 20
X(7, 4) = 5
X(7, 5) = 18
X(7, 6) = 11
'2D array is the data for the chart control.
MSChart1.ChartData = X
'Default chart type is se to 2D bar chart.
MSChart1.chartType = 1

End Sub

Private Sub Check1_Click()
If Check1.Value = 1 Then
'Show Legends
MSChart1.ShowLegend = True
Check1.Caption = "&Hide Legends"
Else
'Hide Legends
MSChart1.ShowLegend = False
Check1.Caption = "&Show Legends"
End If
End Sub

Private Sub Combo1_Click()
'To change the chart type at run time.
MSChart1.chartType = Combo1.ListIndex
End Sub

NOTE:-The above sample code works for default name of controls ,code need to be modified accordly if the name of controls are different.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.