I have developed a small Stock-Take application that runs on a Windows Mobile 6.5 handheld device & uses a SQL Compact 3.5 (.SDF) data file. I built the application in Visual Studio 2008 using VB.Net and it all works fine up to the point where I need to copy the data file back to the connected PC for further processing. When I close the application data entry form, the data file remains locked and I can't copy it to the PC. In the Form_Closed event, I am issuing Dispose commands for both the TableAdapter and BindingSource, and have also added a Garbage Collect command, see code below, but the data file remains locked.
Private Sub StockCheckForm_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.StockCheckTableAdapter.Dispose()
Me.StockCheckBindingSource.Dispose()
GC.Collect()
MsgBox("Form Closed", , "Stock Check")
End Sub