A. Langkah-Langkah Penyelesaian Form Latihan_44_46110043
· Buka project yang telah dibuat sebelumnya.
· Click project kemudian pilih add windows form, seperti pada gambar dibawah ini
· Ketik nama form "Latihan_44_46110043" pada name kemudian click add
· Buat form seperti berikut
· Kemudian beri nama pada semua objek
· Setelah form selesai masukkan rumus seperti dibawah ini Public Class Latihan_44_46110043
Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\Datagrafik.ACCDB")
Dim gitik As New DataTable
Private Sub Latihan_44_46110043_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim kacci As New OleDb.OleDbDataAdapter
kacci = New OleDb.OleDbDataAdapter("select * from qpembelianperbulanan", Jalan)
gitik.Rows.Clear()
kacci.Fill(gitik)
kacci.Dispose()
dgv_46110043.DataSource = gitik
grafik_46110043.RowCount = gitik.Rows.Count
grafik_46110043.ColumnCount = 3
Dim sekarang As Integer = 0
For Each kake As DataRow In gitik.Rows
sekarang = sekarang + 1
grafik_46110043.Row = sekarang
grafik_46110043.RowLabel = kake("Bulan")
grafik_46110043.Column = 1
grafik_46110043.Data = kake("Unit")
grafik_46110043.Column = 2
grafik_46110043.Data = kake("Rata-Rata Harga") / 10000
grafik_46110043.Column = 3
grafik_46110043.Data = kake("Jumlah") / 10000
Next
End Sub
Private Sub GB1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GB1_46110043.Click
grafik_46110043.chartType = MSChart20Lib.VtChChartType.VtChChartType2dBar
End Sub
Private Sub GL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GL_46110043.Click
grafik_46110043.chartType = MSChart20Lib.VtChChartType.VtChChartType2dLine
End Sub
Private Sub GLK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GLK_46110043.Click
grafik_46110043.chartType = MSChart20Lib.VtChChartType.VtChChartType2dPie
End Sub
Private Sub GB2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GB2_46110043.Click
grafik_46110043.chartType = MSChart20Lib.VtChChartType.VtChChartType3dBar
End Sub
Private Sub GL3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GL3_46110043.Click
grafik_46110043.chartType = MSChart20Lib.VtChChartType.VtChChartType3dLine
End Sub
End Class
· Untuk menjalankan form tekan F5
B. Deskripsi Form Latihan 44
Pada form latihan 44 ada 3 object yang digunakan yaitu Data Grid View, Button dan Microsoft Chart Control.
Object DataGridView
Terdapat 1 data grid view pada form latihan 44 yang nantinya akan menampilkan data tabel yang ada pada data base.
Object Button
Ada 5 object button yang digunakan “Grafik Batang, Grafik Line, Grafik Lingkar, Grafik Batang 3D, dan Grafik Line 3D” tombol ini berfungsi untuk menampilkan data grafik berdasarkan nama yang ada pada button.
Object MicrosoftChartControl
Pada form ini digunakan 1 object Microsoft chart control yang akan menampilkan pendapatan dan biaya setiap tahunnya dalam bentuk grafik.
Script Unique
Untuk menampilkan grafik berbentuk batang 2D
grafik_46110039.chartType = MSChart20Lib.VtChChartType.VtChChartType2dBar
Untuk menampilkan grafik berbentuk garis 2D
grafik_46110039.chartType = MSChart20Lib.VtChChartType.VtChChartType2dLine
Untuk menampilkan grafik berbentuk lingkaran
grafik_46110039.chartType = MSChart20Lib.VtChChartType.VtChChartType2dPie
Untuk menampilakan grafik berbentuk batang 3D
grafik_46110039.chartType = MSChart20Lib.VtChChartType.VtChChartType3dBar
Uuntuk menampilkan grafik berbentuk garis 3D
grafik_46110039.chartType = MSChart20Lib.VtChChartType.VtChChartType3dLine
Even
Tidak ada komentar:
Posting Komentar