i'm doing small system using database 03. I had function to add data into a comboBox.
When i add a new data into the the same field using another form, then back to the main Form
the comboBox does not update the current data in database..
please help..codes i tried
'Form Load
Private Sub FrmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\userinfo.accdb")
'con.Open()
Label5.Cursor = Cursors.Hand
lblManage.Cursor = Cursors.Hand
con.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=|DataDirectory|\userinfo.mdb"
con.Open()
getData()
get_class()
End Sub
'function to add data into comboBox
Public Sub get_class()
Dim PCMD As New OleDbCommand
Dim PDR As OleDbDataReader
'cbClass.DisplayMember = "FClass"
'cbClass.ValueMember = "Id"
PCMD.Connection = con
PCMD.CommandText = "select FClass from tblClass"
PDR = PCMD.ExecuteReader
If PDR.HasRows Then
While PDR.Read()
cbClass.Items.Add(PDR("FClass"))
End While
End If
PDR.Close()
End Sub
Thanks Advance..

New Topic/Question
Reply



MultiQuote








|