refresh bindingsource

Status
Not open for further replies.

dreamdelerium

Active member
Joined
Mar 7, 2008
Messages
36
Programming Experience
1-3
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:
VB.NET:
Public Sub InsertMe(ByVal MyQuerrys As String)
        On Error GoTo errorhandler

        '  Dim FileName As String = CurDir() & "\SMSer.mdb"
        Dim conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\JasonWucinski.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()

        'JasonWucinskiBots5


        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

the data gets entered, and will show when i restart the app. but only after i restart it
 
Last edited:
never mind, i figured it out

well, after days of screwing around with this, i was able to make the update. im sure this isnt the best way to do it, but its what i got. for anyone who's interested:
after calling my sub to run the sql querry, i put this
VB.NET:
Dim MyNewDS As New MyDataSet()
Dim staff As MyDataSet.tblStaffDataTable = MyNewDS.tblStaff
Dim newstaff As MyDataSet.tblStaffRow = staff.NewtblStaffRow
staff.Rows.Add(newstaff)
Form1.TblStaffTableAdapter.Fill(Form1.MyDataSet.tblStaff)
staff= Form1.TblStaffTableAdapter.GetData
Form1.ComboBox1.DataSource = staff
 
Status
Not open for further replies.

Latest posts

Back
Top