Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use a form in Revit API

Message 1 of 6
4988 Views, 5 Replies

Use a form in Revit API



I'm new in Revit API and i recently realese some simple API.


I'm now trying to do an API  which use a forms to ask some parameters value to the user in order to set this parameter value to the selected objects. I created the forms with visual studio.


I'm already not able to open the form...


This is my part of code called by pressing the button in revit ribbon panel :


Public Class CommandHTPOT
    Implements IExternalCommand

    Public Function Execute(
      ByVal commandData As ExternalCommandData,
      ByRef message As String,
      ByVal elements As ElementSet) _
    As Result Implements IExternalCommand.Execute

        Dim uiapp As UIApplication = commandData.Application
        Dim app As Application = uiapp.Application

        Dim windowsform As New Form1()
        Dim result = windowsform.ShowDialog()

    End Function
End Class

My research has so far not helped me... When i execute that code I have a transaction error (French language so can't tell you exactly the terms).


 Hoping some help !


Thanks a lots

 Sans titre.png


Message 2 of 6
in reply to: Anonymous

Dear Justin,


First of all, as a beginner, I strongly recommend that you take a close look at the Revit API getting started material, especially the DevTV and My First Revit Plugin tutorials.


That will already answer your question.


You can also look at the Revit SDK samples. Several of them display forms as well. 


Good luck and have fun!


Best regards,



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
in reply to: jeremytammik

Hi Jeremy,

Thanks a lot for this good tip ! I already use Revit SDK Sample. I just found information about Taskdialogue... But nothing about a windows form wich would have created with visual studio allowing to get back some informations.

I think that it's not so really complex. Maybe i have an error with this :


I do not really know how to go further

Really hoping some help

Best regards,

Message 4 of 6
in reply to: Anonymous

Dear Justin,


Yes, the automatic transaction mode is deprecated and has been so for a long time:


"automatic transaction mode is unofficially deprecated, and manual mode is recommended for all cases nowadays. Automatic transaction mode is considered obsolete."


Your add-in is probably not properly set up.


The getting started material will show you how to do so.


So will the Revit SDK samples.


There is absolutely nothing special you need to do to run display a Windows form.





Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
in reply to: jeremytammik

Thank you Jeremy,

In fact it was not a Revit API programation problem but a classic problem.

I just use this and it works great.

Dim wf As New Form1
Thanks a lot !
Message 6 of 6
in reply to: Anonymous

Bonjour, pour votre information, nous avons un forum en français:

Patrick Emin animateur de la communauté francophone

Vous avez trouvé un message utile? Alors donnez un "J'aime" à ce message!
Votre question a eu une réponse satisfaisante? Voulez vous avoir l'amabilité de cliquer sur le bouton
 APPROUVER LA SOLUTION  en bas de la réponse qui apporte une solution?
Signez notre Livre d'Or

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

Post to forums  

Autodesk Customer Advisory Groups

Rail Community