Message 1 of 2
Document.Close method not working after UserForm event CALL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, looking for help to understand why Document Class Close method not working. It is called, but documents remain still opened and I can't change my project until I reboot Inventor Application.
Here is mine main function
Debug.WriteLine("All docs: " & InvApp.Documents.Count)
Debug.WriteLine("Visible documents: " & InvApp.Documents.VisibleDocuments.Count)
Dim oDocs As Documents = InvApp.Documents,
visibleDocs = InvApp.Documents.VisibleDocuments,
visibleDocsList As New List(Of String)
For Each oDoc As Document In visibleDocs
visibleDocsList.Add(oDoc.FullFileName)
Next
For Each oDoc As Document In oDocs
If Not visibleDocsList.Contains(oDoc.FullFileName) Then
oDoc.Close()
End If
Next
Debug.WriteLine("After close docs: " & InvApp.Documents.Count)
Here is event handler
Private Sub manufacturing_radio_btn_CheckedChanged(sender As Object, e As EventArgs) _
Handles manufacturing_radio_btn.CheckedChanged
If manufacturing_radio_btn.IsHandleCreated Then
exportMfc = manufacturing_radio_btn.Checked
DataGridView.Rows.Clear()
DataGridView.Columns.Clear()
AddColumns()
AddRows()
End If
End Sub
AddColumns function just take valid formats from my main class.
AddRows function Loops through each .idw file in given directory, opens it and sends to me valid sheets.
And again if event handler is not called, documents are closed properly, otherwise they remain open.