Dan Flood
asked on
DataSet update via a TIMER
Hi, I cannot seem to get a textbox to update on the timer value - the record count should go up and down, but it just stays the same:
...CODE FOR TIMER1
Dim ready As String
DataReadyPallets1.GetChang es()
SqlDataAdapter1.Update(Dat aReadyPall ets1)
SqlDataAdapter1.Fill(DataR eadyPallet s1)
ready = DataReadyPallets1.tblpalle ts.Rows.Co unt.ToStri ng
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
...END
I know I am doing something foolish, but no time to figure it out. Thanks!
...CODE FOR TIMER1
Dim ready As String
DataReadyPallets1.GetChang
SqlDataAdapter1.Update(Dat
SqlDataAdapter1.Fill(DataR
ready = DataReadyPallets1.tblpalle
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
...END
I know I am doing something foolish, but no time to figure it out. Thanks!
The GetChanges method returns a DataTable object. You need to pass that into your Update method like this:
SqlDataAdapter1.Update(Dat aReadyPall ets1.GetCh anges())
SqlDataAdapter1.Update(Dat
ASKER
Hi,
This now causes an exception error and crashes the program :
Dim ready As String
SqlDataAdapter1.Update(Dat aReadyPall ets1.GetCh anges()) <-- NULL EXCEPTION ERROR.
ready = DataReadyPallets1.tblpalle ts.Rows.Co unt.ToStri ng
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
Also, the textbox2 is rfreshing OK - its a data issue.
This now causes an exception error and crashes the program :
Dim ready As String
SqlDataAdapter1.Update(Dat
ready = DataReadyPallets1.tblpalle
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
Also, the textbox2 is rfreshing OK - its a data issue.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That just hides the error, it doesn't fix the problem :-(
ASKER
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEvent Args) Handles Timer1.Elapsed
Dim ready As String
Try
SqlDataAdapter1.Update(Dat aReadyPall ets1.GetCh anges())
ready = DataReadyPallets1.tblpalle ts.Rows.Co unt.ToStri ng
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
Catch exp As System.ArgumentNullExcepti on
TextBox1.Text = "Update Error."
End Try
End Sub
Dim ready As String
Try
SqlDataAdapter1.Update(Dat
ready = DataReadyPallets1.tblpalle
TextBox1.Text = " READY PALLETS: " & ready
TextBox2.Text = Now()
Catch exp As System.ArgumentNullExcepti
TextBox1.Text = "Update Error."
End Try
End Sub
ASKER
I found the solution myself, but your comment was the closest to helping :) thanks
textbox2.refresh