Author Topic: AutoCAD 2013 --- Application.ShowModalDialog missing.... please help!!  (Read 3161 times)

0 Members and 1 Guest are viewing this topic.

stevenh0616

  • Guest
Hi all,

I'm currently converting some of my applications over to 2013 in which I have dialogs designed in Visual Studio. In past versions we would call the dialog up with something like this:

Code - vb.net: [Select]
  1. <CommandMethod("CommandName")> Public Sub Command()
  2.         Using Form As New Command
  3.             Application.ShowModalDialog(Form)
  4.         End Using
  5.     End Sub

However, I have spent the last hour and a half trying to find documentation on how to get this working in 2013 as the 'ShowModalDialog' method no longer exists. Anyone know where this has moved to with the new API?? Or was it completely removed?? Does not make any sense to me why this would change as it seemed totally fine in the last versions. Why fix something if it works?!?  :x :pissed: :pissed: :x

Thanks.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: AutoCAD 2013 --- Application.ShowModalDialog missing.... please help!!
« Reply #1 on: October 07, 2012, 05:25:37 PM »
ShowModalDialog() is still there.
This, however, looks suspicious:

Public Sub Command
Using Form As New Command

Jeff H

  • Needs a day job
  • Posts: 6150
Re: AutoCAD 2013 --- Application.ShowModalDialog missing.... please help!!
« Reply #2 on: October 07, 2012, 05:27:09 PM »
Do you have?
Code - Visual Basic: [Select]
  1. Imports Autodesk.AutoCAD.ApplicationServices.Core

Application class in Acmgd.dll in Autodesk.AutoCAD.ApplicationServices namespace contains the ShowModalDialog method which inherits from Application class in accoremgd.dll contained in Autodesk.AutoCAD.ApplicationServices.Core namespace.
 
So if you have Imports Autodesk.AutoCAD.ApplicationServices.Core you are only seeing the static methods in Application abstract class
 
You need to remove Core
Code - Visual Basic: [Select]
  1. Imports Autodesk.AutoCAD.ApplicationServices

If some other code in file depends on Autodesk.AutoCAD.ApplicationServices.Core you can add do something like
Code - Visual Basic: [Select]
  1. Imports Autodesk.AutoCAD.ApplicationServices.Core
  2. Imports AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application
  3.  

and then of course
Code - Visual Basic: [Select]
  1.         <CommandMethod("CommandName")> Public Sub Command()
  2.             Using Form As New Command
  3.                 AcadApplication.ShowModelessDialog(Form)
  4.             End Using
  5.         End Sub
  6.  

 
 As Jeff_M pointed out Command is not a good name for method or a Forms object.
« Last Edit: October 07, 2012, 07:31:58 PM by Jeff H »

stevenh0616

  • Guest
Re: AutoCAD 2013 --- Application.ShowModalDialog missing.... please help!!
« Reply #3 on: October 07, 2012, 07:26:32 PM »
Thank you both!! I was just overthinking the problem I guess and had to step away from the keyboard...

I didn't have the acmgd.dll referenced, just the accoremgd.dll... for some reason I thought that was all I needed.

Problem solved!!

stevenh0616

  • Guest
Re: AutoCAD 2013 --- Application.ShowModalDialog missing.... please help!!
« Reply #4 on: October 07, 2012, 07:35:54 PM »
Oh and I guess where I had put Command, should have said MyCommand or something... it was just a filler to put here on the Swamp.

Sorry for the confusion!!