.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Displaying Forms

1 REPLY 1
Reply
Message 1 of 2
Lance_Turbo
272 Views, 1 Reply

Displaying Forms

Hi,

 

I'm quite new to this and so please point me in the right direction if this is not the right place to post.

 

I have been testing some code to display a form using VB.NET and Autocad 2006. The code does not perform anything useful at this stage but I can't understand where this error is coming from. I use the code below to display "myForm".

 

<CommandMethod("sf")> _
    Public Sub sf()

        Dim myForm As New CreateProjectForm

        Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(myForm)

    End Sub

 

Then in order to determine the order of events I use the code below for CreateProjectForm:

 

Public Class CreateProjectForm

    Private Sub CreateProjectForm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        MsgBox("Form Activated")
    End Sub

    Private Sub CreateProjectForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox("Form Loaded")     
    End Sub

End Class

 

In debug mode the program "Form Loaded" msgbox is displayed and then the following error "There is no source code available for the current location."

 

When run normally, both the "Form Loaded" and "Form Activated" display however the "Form Activated" does not close when I hit ok.

 

Can anyone please explain what is going on here? Any ideas would be greatly appreciated, more to help me understand the workings behind my code more so than to help me get the end result.

 

Thanks,

Ben

Tags (2)
1 REPLY 1
Message 2 of 2
hgasty1001
in reply to: Lance_Turbo

Hi,

 

The problem with "no source code..." is probably related to fibers, set NEXTFIBERWORLD to 0 and close Autocad, this will set Autocad to not use fibers, but this has a cost, no ribbon response, and some wierd problems, however it should permit you to debug the form code.

The problem with no closing the message box maybe it's related to the way of callinstancing the form, you usually have to declare the form variable as "the form you are  to call": Dim myForm as TheForm= new TheForm, and then tell Autocad to show the form: Application.ShowModalDialog(frm) .

 

Gaston Nunez

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost