Ok how can I fill out a data grid view from an event?
Upon receiving a serialized object across the network I raise an event and pass the deserialized object.
The event handler is on a form with a data grid view control
If I try to add a row (based on the data in the object) to this control or add a row to a table in the dataset that the control is bound to it just crashes with no errors
(It screws the screen up graphically and then freezes the whole app I cant even catch this in a try catch statement)
I think its because I am trying to call the add row method asynchronously?
(since the method that raises the event is called from a method that is reading from a tcp client getstream.endread AsyncResult)
I get the exact same problem if I try to add the rows directly or if I try to add rows to a table in a dataset thats bound to the control
And its not because its still sending because if in the event handler I add the ID of the object to a text box insted, I can see them all fill the textbox nicely and then stop at the end with no problems
I tried getting the event handler method to add the objects to an array list (in the form class) and then getting a timer control to add the items in the array list to the grid view one by one. This works but its unnecessarily slow and cumbersome.
Does anyone have any ideas?
PS. I am already guessing I am doing something stupid
Upon receiving a serialized object across the network I raise an event and pass the deserialized object.
The event handler is on a form with a data grid view control
If I try to add a row (based on the data in the object) to this control or add a row to a table in the dataset that the control is bound to it just crashes with no errors
(It screws the screen up graphically and then freezes the whole app I cant even catch this in a try catch statement)
I think its because I am trying to call the add row method asynchronously?
(since the method that raises the event is called from a method that is reading from a tcp client getstream.endread AsyncResult)
I get the exact same problem if I try to add the rows directly or if I try to add rows to a table in a dataset thats bound to the control
And its not because its still sending because if in the event handler I add the ID of the object to a text box insted, I can see them all fill the textbox nicely and then stop at the end with no problems
I tried getting the event handler method to add the objects to an array list (in the form class) and then getting a timer control to add the items in the array list to the grid view one by one. This works but its unnecessarily slow and cumbersome.
Does anyone have any ideas?
PS. I am already guessing I am doing something stupid