| | |
Urgent: Graph Creation in Vb and Form-linking
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
NOTE:-The above sample code works for default name of controls ,code need to be modified accordly if the name of controls are different.
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
vb Syntax (Toggle Plain Text)
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.
Share your Knowledge.
![]() |
Similar Threads
- Need help printing from vb (Visual Basic 4 / 5 / 6)
- displaying labview graph on vb6 form (Visual Basic 4 / 5 / 6)
- Campaign Strategist (Internet Marketing Job Offers)
- SEM Professionals (Internet Marketing Job Offers)
- Sem (Internet Marketing Job Offers)
- Problems in Dynaform (Form Mail) URGENT HELP (PHP)
- Registration form help (ColdFusion)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Q: Data Report Group Header
- Next Thread: File transfer troubles
Views: 2457 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 429 2007 access activex add age append application basic beginner birth c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






