Hi all
i have this bit of code for searching for a number from a db and returning it to a datagridview
vb.net Code:
Dim con5 As New OleDb.OleDbConnection Dim ds5 As New DataSet Dim da5 As OleDb.OleDbDataAdapter Dim SQL5 As String con5.ConnectionString = My.Settings.GoodsinConnect con5.Open() ds5.Clear() SQL5 = "SELECT * FROM [ReceiptLines] WHERE [PartNo] ='" & Partnumber & "'" da5 = New OleDb.OleDbDataAdapter(SQL5, con5) da5.Fill(ds5, "ReceiptLines") dgvPartNumbers.DataSource = ds5.Tables(0).DefaultView con5.Close()
This works fine.
However when a user updates a record that is shown via another form. When they are returned back to the main form i want the record to be updated.
So for now i put a simple timer in that looks when the record is updated and a value is changed and when it has then it triggers
vb.net Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If RefreshData = 1 Then btnSearch_Click(Me, EventArgs.Empty) RefreshData = 0 End If End Sub
I've also tried:
vb.net Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If RefreshData = 1 Then btnSearch.PerformClick() RefreshData = 0 End If End Sub
Although it goes through the code like it would it doesnt actually update the datagridview.
However if i press the button on the form it updates it.
Can anyone help me out here.
Thanks
Alex




Reply With Quote