I am porting an existing VBA macro to VSTA/VB.NET. The macro displays a modeless form and allows the user to interact with the drawing. When the user is done he clicks a button in the form, and the macro continues on. This worked in VBA using `DoEvents`:
frmDrawingReview.Show (False)
Do While frmDrawingReview.Visible
DoEvents
Loop
I have tried different approaches to accomplish the same thing in VB.NET but can't get it to work. If I use similar code then the form displays, but I can't interact with the Solidworks drawing:
Dim frmEditDrawing As New EditDrawingDialog
frmEditDrawing.Show()
Do While frmEditDrawing.Visible
Application.DoEvents()
Loop
Everything I've read says DoEvents() is rarely the correct solution, but I don't know how else to accomplish my intent.
Edited 6/22/17 to include more information that I added in a later post:
We have 2 draftsmen in the office that use Solidworks to model sheet metal parts. They process a lot of unique parts and need a quick way to print drawings for fabrication and to export flat patterns for laser cutting. I originally wrote a macro in VBA that, given an assembly, traverses each subassembly and part, and for each part opens its drawing, exports to PDF, and if it is sheet metal exports flat patterns to DXF. After opening each drawing and before exporting files, it presents a dialog to the user to either approve, edit or skip the drawing. If the user chooses "edit", the macro waits for the user to modify and save the drawing, then continues processing.
I currently have implemented the "edit drawing" functionality by displaying a modeless form with one button to the user. When the user is done editing the drawing, he clicks the button on the modeless form, and the macro continues on. This was accomplished using DoEvents.
Message was edited by: Ryan Doving