Add Code

Add Code

Add the following code to create the add-in. When writing the code in VB.NET, you must pay attention to key letter capitalization.

Code Region 30-9: Hello World in VB.NET

Imports System

Imports Autodesk.Revit.UI
Imports Autodesk.Revit.DB

<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.ReadOnly)> _
Public Class HelloWorld
Implements IExternalCommand
        Public Function Execute(ByVal revit As ExternalCommandData, ByRef message As String, _
                                                        ByVal elements As ElementSet) As Autodesk.Revit.UI.Result _
                                                        Implements IExternalCommand.Execute

                TaskDialog.Show("Revit", "Hello World")
                Return Autodesk.Revit.UI.Result.Succeeded

        End Function
End Class