this coding working.
but this coding simple coding..
can anyone give idea how to make this coding looking nice ?
Imports System.Data
Public Class frmANGGARANBARU
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub frmANGGARANBARU_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'SISTEM_DATABASEDataSet.KadarPremium' table. You can move, or remove it, as needed.
Me.KadarPremiumTableAdapter.Fill(Me.SISTEM_DATABASEDataSet.KadarPremium)
'TODO: This line of code loads data into the 'SISTEM_DATABASEDataSet.PelanFaedah' table. You can move, or remove it, as needed.
Me.PelanFaedahTableAdapter.Fill(Me.SISTEM_DATABASEDataSet.PelanFaedah)
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = H:\PROJEK\New Sistem\SISTEM_DATABASE.mdb"
con.Open()
con.Close()
End Sub
Private Sub ShowPelan()
sql = "SELECT * FROM PelanFaedah"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "PelanFaedah")
txtKHUKK.Text = ds.Tables("PelanFaedah").Rows(cmbPelan.SelectedIndex).Item(1)
txt36P.Text = ds.Tables("PelanFaedah").Rows(cmbPelan.SelectedIndex).Item(2)
txtPHH.Text = ds.Tables("PelanFaedah").Rows(cmbPelan.SelectedIndex).Item(3)
txtPKKAAK.Text = ds.Tables("PelanFaedah").Rows(cmbPelan.SelectedIndex).Item(4)
End Sub
Private Sub cmbPelan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPelan.SelectedIndexChanged
ShowPelan()
End Sub
Private Sub cmbPremium_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPremium.SelectedIndexChanged
sql = "SELECT * FROM KadarPremium"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "KadarPremium")
If cmbPelan.SelectedIndex = "1" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(1)
ElseIf cmbPelan.SelectedIndex = "2" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(2)
ElseIf cmbPelan.SelectedIndex = "3" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(3)
ElseIf cmbPelan.SelectedIndex = "4" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(4)
ElseIf cmbPelan.SelectedIndex = "5" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(5)
ElseIf cmbPelan.SelectedIndex = "6" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(6)
ElseIf cmbPelan.SelectedIndex = "7" Then
txtPremium.Text = ds.Tables("KadarPremium").Rows(cmbPremium.SelectedIndex).Item(7)
End If
End Sub
End Class