Public Class frmSettingDB

    Private Sub frmSettingDB_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        If Asc(e.KeyChar) = Keys.Enter Then
            SendKeys.Send("{tab}")
        End If
    End Sub

    Private Sub frmSettingDB_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tServer.Text = GetSetting("Prediksi_Usaha_Kecil", "Database", "Nama Server", "") 'ambil nilai dr registry, jika blm ada isi dgn karakter kosong ""
        tDatabase.Text = GetSetting("Prediksi_Usaha_Kecil", "Database", "Nama Database", "")
        tUser.Text = GetSetting("Prediksi_Usaha_Kecil", "Database", "User", "")
        tPassword.Text = GetSetting("Prediksi_Usaha_Kecil", "Database", "Password", "")
        tPort.Text = GetSetting("Prediksi_Usaha_Kecil", "Database", "Port", "")

    End Sub



    Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click

        If MsgBox("Setting Database Di Simpan ???", vbYesNo + vbQuestion + vbDefaultButton2, "Konfirmasi") = vbYes Then
            SaveSetting("Prediksi_Usaha_Kecil", "Database", "Nama Server", Trim(tServer.Text))
            SaveSetting("Prediksi_Usaha_Kecil", "Database", "Nama Database", Trim(tDatabase.Text))
            SaveSetting("Prediksi_Usaha_Kecil", "Database", "User", Trim(tUser.Text))
            SaveSetting("Prediksi_Usaha_Kecil", "Database", "Password", Trim(tPassword.Text))
            SaveSetting("Prediksi_Usaha_Kecil", "Database", "Port", Trim(tPort.Text))
            Me.Close()
            Call Koneksi()
        End If
    End Sub

    Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click

        Me.Close()
        Call Koneksi()
    End Sub

End Class