VB.net debugging when prompt pause

VB.net debugging when prompt pause

harryliu3140
Enthusiast Enthusiast
837 Views
2 Replies
Message 1 of 3

VB.net debugging when prompt pause

harryliu3140
Enthusiast
Enthusiast

Hi,

 

My program tools are VB.net express 2005 with ACAD MEP 2008.

 

I want to debug a program with GetSelection or GetPoint where the program will pause waiting for user input. The ACAD MEP 2008 will stop running with an "FATAL ERROR: unhandled exception" error when debugging steps to the GetSelection/GetPoint function.

 

I have no issue when I load the released .dll into ACAD and run. The program like this:

 

    Public Sub Cmd1() ' This method can have any name
        ' Type your code here
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim pntoption As New PromptPointOptions("Please pick a location as the center of the curves")
        Dim pntresult As PromptPointResult


        Dim Opts As New PromptSelectionOptions()
        Opts.SingleOnly = True
        Opts.MessageForAdding = "Select a curve entity"
        Dim res As PromptSelectionResult = ed.GetSelection(Opts)
        If res.Status = PromptStatus.Error Then
            Return
        End If
        Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value 

I search in Discussion Groups seem nobody encountered this problem. The error also happen in ACAD MEP 2010.

 

Hope some know how to get arround.

 

Thanks.

0 Likes
838 Views
2 Replies
Replies (2)
Message 2 of 3

chiefbraincloud
Collaborator
Collaborator

There is nothing glaring at me, and I do not have MEP installed to try to test, so all I could suggest is to wrap everything into one or more Try/Catch blocks to see if you can step through and get an error message instead of a Fatal Error.

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 3 of 3

harryliu3140
Enthusiast
Enthusiast

That's just what I need to do.

 

You can see I'm a beginner of VB.net. I haven't realized Try/Catch is so useful.

 

Your help is so appreciated.

 

Thank you.

0 Likes