I have a program where I have a timer and on the ticks I want to check to see if a dataset has updated. I know the dataset is updating but the event is not firing. Can someone please show me what I'm doing wrong Below is my code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'ChatroomlogDataSet.chat' table. You can move, or remove it, as needed.
Me.ChatTableAdapter.Fill(Me.ChatroomlogDataSet.chat)
Me.Timer1.Start()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.ChatTableAdapter.InsertChat("Buttonsub", Me.TextBox1.Text)
Me.Validate()
Me.ChatBindingSource.EndEdit()
Me.ChatTableAdapter.Update(Me.ChatroomlogDataSet.chat)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Me.ChatroomlogDataSet.chat.GetChanges IsNot Nothing Then
Me.ChatTableAdapter.FillAll(Me.ChatroomlogDataSet.chat)
End If
End Sub

.HasChanges and .GetChanges not working?
canislupus
Me.ChatroomlogDataSet.chat.AcceptChanges()
After the tableadapterupdate call but it still isn't triggering my if statement. Am I missing something
Erik11
Hi Gordon,
FYI: If you think that your post is answered then click on "Mark as Answer" to mark it as answered.
Thank you,
Bhanu.
Fer Mayorga
hi,
i don't know if that will work with tables or not but i have tried acceptchanges with dataset and it worked fine with me but even though you can achive that by two varaibles in your form
dim oldreading, currentreading as integer
in your formload sub set current reading and oldreader = yourtable.rows.count when you add any record to your table increase currentreading, in your timer tick event check if oldreading < currentreading / do something
then set oldreading = currentreading
one more thing using databases for chating is not a good solution you have to take a look to system.net.sockets namespace those are some examples
building udp program >>> http://www.codeproject.com/vb/net/UDP_Send_Receive.asp
udp socket for chat >>> http://msdn2.microsoft.com/en-us/library/c19ex43h(en-US,VS.80).aspx
chat sample >>> http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnadvnet/html/vbnet08282001.asp
chat sample useing asp.net >>> http://www.codeproject.com/aspnet/AliAspNetChat.asp
chat sample useing soket >>> http://www.codeproject.com/Purgatory/ChatApplDotNetSockets.asp
hope that helps
JL3
hi,
haschanged will not work because your dataset don't indicate any changes. to be able to use haschanged you have to call mydatset.acceptchanges first after every record you add
hope this helps