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.


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


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.


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


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

About the Author

Based in Memphis, Jackson Lewis has been writing on technology-related material for 10 years with a recent emphasis on golf and other sports. He has been freelance writing for Demand Media since 2008. Lewis holds a Master of Science in computer science from the United States Naval Postgraduate School.

More Articles