x

How to Make Graphs With Visual Basic

by Jackson Lewis

Visual Basic is the Microsoft sponsored, event-based, programming language that supports the .NET and .COM programming models. Since Visual Basic is component-based, software developers are able to create advanced programs in a rapid manner by re-using predefined components in Visual Basic. A common task for Visual Basic developers is to create a graph with Visual Basic to display data to the end user.

Step 1

Open the Visual Basic Integrated Development Environment (IDE) on your computer.

Step 2

Choose a new form from the Visual Basic file menu. Then, select the "MSChart Control" menu option from the Visual Basic toolbar and single left click the form in Visual basic to insert the chart on your form.

Step 3

Pick the type of graph to insert on your Visual Basic form. For this example, a "Bar Graph" is chosen.

Step 4

Double click the MS Chart control object on your form. Enter the following code in the chart control programming information. Private Sub Command1_Click() Chart.Column = 1 Chart.Data = 1500 Chart.Column = 2 Chart.Data = 3000 Chart.Column = 3 Chart.Data = 4500 End Sub

Select the "File->Save" menu choice and then click the "F5" keyboard function key to run the Visual Basic program that will display a basic bar graph.

Video of the Day

Brought to you by Techwalla
Brought to you by Techwalla

More Articles