none
dispose entity , bindingsource ??? RRS feed

  • Question

  • Hello !

    i have a form with a bindingsource to an entity object.

    What can i do when the form is closed to release all the resources used by entity and the bindingsource ?

    Can i use

    tab1Bindingsource.dispose ?

    or

    aentity.dispose ???

     

    ?????

    Wednesday, August 31, 2011 10:40 PM

Answers

  • Hello,

    Bindingsource keeps a reference which points to the controls. So GC collects this resource after the control was disposed. Bindingsource didn't implement IDisposable itself. So you cannot use USING keyword automatically everything. IMO, if you want to dispose Bindingsource, two alternative suggestions. One you can let the form was released and the control was also done, then you can dispose Bindingsource. Another, you can clear the datasource such as DataSet or others, then you can smoothly dispose Bindingsource.

    Thanks,


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Friday, September 9, 2011 6:43 AM
    Friday, September 2, 2011 3:42 AM