Solved

Graphs in VB?

Posted on 2000-03-27
2
269 Views
Last Modified: 2010-05-02
I need a really good graph control to display records from SQL7 thru ADO. I need to be able to really customize it.
0
Comment
Question by:hutchison
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Accepted Solution

by:
AshokKumar earned 50 total points
ID: 2662942
Nice Friend. Here it goes. The entire code. <Smile>

First declare a recordset and a connection. Then include the component MSChart in the form. I have used MS Access as backend and as a programmer u would easily convert the Access connection to SQL connection. Remaining all are same (ie. recordset and all that).

Private adoRs As New ADODB.Recordset
Private adoCn As New ADODB.Connection

Then in the form load event

Private Sub Form_Load()

Dim strSql As String

adoCn.ConnectionString = _
   "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
   "C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb"

adoCn.Open 'Open the connection
   
   ' Create a query that retrieves only four fields.
   strSql = "SELECT ProductName, UnitPrice, " & _
   "UnitsInStock, UnitsOnOrder FROM Products WHERE SupplierID = 1"

adoRs.Open strSql, adoCn, adOpenKeyset

   ' Set the DataSource to the recordset.
   With MSChart1
      .ShowLegend = True
      Set .DataSource = rsProducts
   End With
End Sub


JUst copy this code and u'll get the result u wanted. U can set the Chart type as graphical type. U have 9 types to choose from. Get back to me.
0
 

Expert Comment

by:AshokKumar
ID: 2671906
Thanks hutchison but y Grade B.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question