hi everyone. im not sure if i should post this here or what but heres my question: i have a main form with a combo-box that is connected to a binding source (a microsoft access table). in a dialog, i let the user add/delete items in the table. how do i refresh the binding source on my original form to reflect the changes.
oh, and i insert data into my table by using the following sub:
the data gets entered, and will show when i restart the app. but only after i restart it. ive also tried to just add the data to the combobox but it wont let me as its bound to a table. is it possible to unbind a control programatically?Code:Public Sub InsertMe(ByVal MyQuerrys As String) On Error GoTo errorhandler Dim conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\MyDb.mdb;Persist Security Info=True;Jet OLEDB:Database Password=") Dim Cmd As OleDbCommand Dim objCmd As New OleDbCommand Cmd = New OleDbCommand(MyQuerrys, conn) conn.Open() objCmd = New OleDbCommand(MyQuerrys, conn) objCmd.ExecuteNonQuery() conn.Close() If Not (Cmd Is Nothing) Then Cmd.Dispose() Cmd = Nothing If Not (objCmd Is Nothing) Then objCmd.Dispose() objCmd = Nothing errorhandler: If Err.Number = 0 Then ElseIf Err.Number = 5 Then MsgBox("You have an item with that name already. Type a unique identifier") Else MsgBox(Err.Number) End If End sub




Reply With Quote