Imports System.Data.Odbc
Public Class frmMenuUtama
    Private m_strFullCaption As String
    Private m_strCurrentCaption As String
    Private m_ynLeftRight As Boolean

    Private Sub frmMenuUtama_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim nLebarLayar As Integer
        Dim nTinggiLayar As Integer
        Me.Text = "Aplikasi Data Mining dengan Algoritma Linier Regresi"
        m_strFullCaption = Me.Text
        m_strCurrentCaption = ""
        m_ynLeftRight = True
        nTinggiLayar = Me.Height
        nLebarLayar = Me.Width - 16
    End Sub

    Private Sub mnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnKeluar.Click
        If MessageBox.Show("Benar Ingin Keluar dari Sistem..?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
            Conn.Close()
            End
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        On Error Resume Next
        If m_ynLeftRight Then

            If Len(m_strCurrentCaption) < Len(m_strFullCaption) Then
                m_strCurrentCaption = Microsoft.VisualBasic.Left(m_strFullCaption, Len(m_strCurrentCaption) + 1)
                Me.Text = m_strCurrentCaption
            Else
                m_ynLeftRight = Not m_ynLeftRight
            End If

        Else

            If Len(m_strCurrentCaption) > 0 Then
                m_strCurrentCaption = Microsoft.VisualBasic.Right(m_strFullCaption, Len(m_strCurrentCaption) - 1)
                Me.Text = m_strCurrentCaption
            Else
                m_ynLeftRight = Not m_ynLeftRight
            End If

        End If
    End Sub

    Private Sub mnBackupDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnBackupDB.Click
        FrmBakcupRestore.Show(Me)
    End Sub

    Private Sub mnSettingDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnSettingDB.Click
        frmSettingDB.Show(Me)
    End Sub

    Private Sub mnDataSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnDataSet.Click
        frmDataSet.Show(Me)
    End Sub

    Private Sub mnPrediksi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnPrediksi.Click
        frmPrediksi.Show(Me)
    End Sub

    Private Sub mnLapDataSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnLapDataSet.Click
        FrmLapDataset.Show(Me)
    End Sub

    Private Sub mnLapHasilPrediksi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnLapHasilPrediksi.Click
        frmLapHasilPrediksi.Show(Me)
    End Sub

    Private Sub mnHitungAkurasi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnHitungAkurasi.Click
        frmHitungAkurasi.Show(Me)
    End Sub

    Private Sub mnLapAkurasi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnLapAkurasi.Click
        Dim frmCetakHasil As New frmLaporan
        Dim Cetakdata As CrystalDecisions.CrystalReports.Engine.ReportDocument
        Dim cAkurasi_AWal, cAkurasi_Akhir As String
        cmd = New OdbcCommand("Select * from tbsetting_dataset ", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            cAkurasi_AWal = rd.Item("akurasi_awal")
            cAkurasi_Akhir = rd.Item("akurasi_akhir")
            Cetakdata = New rptAkurasi
            frmCetakHasil.CRV.ReportSource = Nothing
            frmCetakHasil.CRV.SelectionFormula = "{tbdataset1.no_indeks} >= " & cAkurasi_AWal & " And {tbdataset1.no_indeks} <= " & cAkurasi_Akhir & ""
            frmCetakHasil.CRV.ReportSource = Cetakdata
            frmCetakHasil.CRV.Refresh()
            frmCetakHasil.CRV.RefreshReport()
            frmCetakHasil.Show(Me)
        End If
    End Sub

    Private Sub mnUbahPassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnUbahPassword.Click
        frmUbahPassword.Show(Me)
    End Sub

    Private Sub mnSettingDataset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnSettingDataset.Click
        frmSettingDataset.Show(Me)
    End Sub


    Private Sub mnDataUser_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnDataUser.Click
        frmUser.Show(Me)
    End Sub

End Class