.NET

Reply
New Member
Lance_Turbo
Posts: 2
Registered: ‎01-08-2009
Message 1 of 2 (87 Views)

Displaying Forms

87 Views, 1 Replies
05-27-2014 04:45 AM

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

Valued Mentor
gasty1001
Posts: 475
Registered: ‎04-11-2010
Message 2 of 2 (64 Views)

Re: Displaying Forms

05-27-2014 08:44 AM 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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.