Option Strict Off
Imports System.Data.Odbc
Public Class FrmLapKriteria
    Dim cKode As String
    Sub TampilKriteria()
        da = New OdbcDataAdapter("Select * from tbkriteria order by kode_kriteria", Conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, "tbkriteria")
        DGV.DataSource = (ds.Tables("tbkriteria"))
        DGV.ReadOnly = True
        DGV.AllowUserToAddRows = False
        DGV.Columns(0).Width = 100
        DGV.Columns(1).Width = 300
        DGV.GridColor = Color.Blue
        DGV.DefaultCellStyle.ForeColor = Color.Blue
        DGV.RowHeadersDefaultCellStyle.BackColor = Color.DeepPink
        DGV.AlternatingRowsDefaultCellStyle.BackColor = Color.Yellow
        DGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        DGV.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        DGV.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        DGV.Columns(0).HeaderText = "Kode Kriteria"
        DGV.Columns(1).HeaderText = "Nama Kriteria"
    End Sub
    Sub TampilSubKriteria()
        da = New OdbcDataAdapter("Select kode_sub,sub_kriteria " & _
                                 "from tbsub_kriteria where kode_kriteria = '" & cKode & "' order by kode_sub", Conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, "tbsub_kriteria")
        Dgv2.DataSource = (ds.Tables("tbsub_kriteria"))
        Dgv2.ReadOnly = True
        Dgv2.AllowUserToAddRows = False
        Dgv2.Columns(0).Width = 100
        Dgv2.Columns(1).Width = 330
        Dgv2.GridColor = Color.Blue
        Dgv2.DefaultCellStyle.ForeColor = Color.Blue
        Dgv2.RowHeadersDefaultCellStyle.BackColor = Color.DeepPink
        Dgv2.AlternatingRowsDefaultCellStyle.BackColor = Color.Yellow
        Dgv2.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        Dgv2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        Dgv2.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        'dgv2.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        Dgv2.Columns(0).HeaderText = "Kode Sub"
        Dgv2.Columns(1).HeaderText = "Sub Kriteria"
    End Sub
    Private Sub FrmLapKriteria_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call TampilKriteria()
    End Sub

    Private Sub btnTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTutup.Click
        Me.Dispose()
    End Sub

    Private Sub DGV_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellContentClick
        cKode = DGV.Rows(e.RowIndex).Cells(0).Value
        Call TampilSubKriteria()
    End Sub

    Private Sub DGV_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellContentDoubleClick
        cKode = DGV.Rows(e.RowIndex).Cells(0).Value
        Call TampilSubKriteria()
    End Sub

    Private Sub btnCetak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCetak.Click
        Dim frmCetakKriteria As New FrmLaporan
        frmCetakKriteria.CRV.ReportSource = Nothing
        frmCetakKriteria.CRV.ReportSource = "rptkriteria.rpt"
        frmCetakKriteria.Show(Me)
    End Sub
End Class