Site Map Mail This To A Friend PrivacyPolicy Subscribe to MakeLogic RSS Feed

Sample Applications Written in VB.net

See : Samples in VB .NET
Samples can be written in any language that supports the CLR (Common Language Runtime) of the .NET Compact Framework

Graphs Navigation Sample in VB.NET

The following sample application demonstrates how to display a LineGraph, BarGraph and PieGraph in a single application and how to navigate from one graph to the other. Please see the screen shots of the sample application shown below ( click to enlarge )

MicroGraphs Screenshot MicroGraphs Screenshot MicroGraphs Screenshot

Click here to download the source code

'This sample can use to navigate graphs(BarGraph, LineGraph, PieGraph) with different data, clicking on Next, 'Previous 'and Again buttons
' Product Of : MakeLogic
' URL : http://www.makelogic.com
' Author : Raji Chinnam
' Date : 20 June, 2003
' Last Modified : 15 October, 2007
' email : info@makelogicmldb.com
' Please feel free to use this Sample Code in your Application.
' This program demonstrates the Navigation of BarGraphs,LIneGraphs and PieGraphs component of the MicroGraphs

Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Dim BarGraphDemo As New MakeLogic.MG.BarGraph
Dim LineGraphDemo As New MakeLogic.MG.LineGraph
Dim PieGraphDemo As New MakeLogic.MG.PieGraph
Dim Nav As Integer, ArrCount As Integer
Dim xValues(6) As Double, yValues(6) As Double, PieLabels(6) As String
Dim LineXValues(20) As Double, LineYValues(20) As Double
Dim RandomVar As New System.Random

#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents cmdPrev As System.Windows.Forms.Button
Friend WithEvents cmdNext As System.Windows.Forms.Button
Friend WithEvents cmdData As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.cmdPrev = New System.Windows.Forms.Button
Me.cmdNext = New System.Windows.Forms.Button
Me.cmdData = New System.Windows.Forms.Button
'
'cmdPrev
'
Me.cmdPrev.Location = New System.Drawing.Point(25, 231)
Me.cmdPrev.Size = New System.Drawing.Size(58, 24)
Me.cmdPrev.Text = "Previous"
'
'cmdNext
'
Me.cmdNext.Location = New System.Drawing.Point(158, 231)
Me.cmdNext.Size = New System.Drawing.Size(46, 24)
Me.cmdNext.Text = "Next"
'
'cmdData
'
Me.cmdData.Location = New System.Drawing.Point(85, 231)
Me.cmdData.Size = New System.Drawing.Size(70, 24)
Me.cmdData.Text = "Again"
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
'
'Form1
'
Me.BackColor = System.Drawing.Color.FromArgb(CType(204, Byte), CType(204, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(370, 296)
Me.Controls.Add(Me.cmdData)
Me.Controls.Add(Me.cmdNext)
Me.Controls.Add(Me.cmdPrev)
Me.Menu = Me.MainMenu1
Me.Text = "Navigation Of Graphs"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
End Sub
#End Region

Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
If (Nav < 3) Then
Nav = Nav + 1
Else
Nav = 1
End If
Call Navigation(Nav)
End Sub
Private Sub cmdPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrev.Click
If (Nav <= 3 And Nav > 1) Then
Nav = Nav - 1
Else
Nav = 3
End If
Call Navigation(Nav)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ControlBox = True
Me.MinimizeBox = False
Me.FormBorderStyle = FormBorderStyle.SizableToolWindow
Nav = 1
BarGraphDemo.Left = 18
BarGraphDemo.Top = 23
LineGraphDemo.Left = 18
LineGraphDemo.Top = 23
PieGraphDemo.Left = 18
PieGraphDemo.Top = 23
Call BarGraph()
End Sub
Sub BarGraph()

For ArrCount = 1 To 6
xValues(ArrCount) = RandomVar.Next(5, 40)
yValues(ArrCount) = xValues(ArrCount) + 3
Next
'Assigning Data to the Bargraph
BarGraphDemo.XValues = xValues
BarGraphDemo.YValues = yValues
Me.Controls.Add(BarGraphDemo)
End Sub
Sub LineGraph()

For ArrCount = 1 To 20
LineXValues(ArrCount) = ArrCount + 2
LineYValues(ArrCount) = RandomVar.Next(7, 50)
Next
'Assigning Data to the Linegraph
LineGraphDemo.XValues = LineXValues
LineGraphDemo.YValues = LineYValues
Me.Controls.Add(LineGraphDemo)
End Sub
Sub PieGraph()

For ArrCount = 1 To 6
xValues(ArrCount) = RandomVar.Next(5, 40)
PieLabels(ArrCount) = "Data" & ArrCount
Next
'Assigning Data to the Piegraph
PieGraphDemo.Data = xValues
PieGraphDemo.Labels = PieLabels
Me.Controls.Add(PieGraphDemo)
End Sub
Sub Navigation(ByVal Nav)
If Nav = 1 Then
Me.Controls.Remove(LineGraphDemo)
Me.Controls.Remove(PieGraphDemo)
Me.Controls.Remove(BarGraphDemo)
Call BarGraph()
ElseIf Nav = 2 Then
Me.Controls.Remove(LineGraphDemo)
Me.Controls.Remove(PieGraphDemo)
Me.Controls.Remove(BarGraphDemo)
Call LineGraph()
ElseIf Nav = 3 Then
Me.Controls.Remove(LineGraphDemo)
Me.Controls.Remove(PieGraphDemo)
Me.Controls.Remove(BarGraphDemo)
Call PieGraph()
End If
End Sub
Private Sub cmdData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdData.Click
Call Navigation(Nav)
End Sub
End Class
 

Was this information helpful to you?
Rock The Vote Next Poll Question

RSS Feeds
Subscribe to MakeLogic RSS Feed Add to My Yahoo! Add to Google
NewsLetter