It looks like you might be mixing up the UIApplication, and the Application.
If you want the UIApplication, I think you need to use:
Dim uiapp As New UIApplication(Application)
If you want the actual application, I think you just use the "Application" keyword, or if you are in a document level macro, use the Document.Application keyword.
http://help.autodesk.com/view/RVT/2019/ENU/?guid=GUID-C6E0196D-918B-4131-9B64-050DBE452158
Hello.
You're trying to get the "Application" member from the form class, that's not going to work. I don't know the best solution, but this worked for me:
Form:
Public Partial Class Form1 Inherits System.Windows.Forms.Form Private m_uidoc As UIDocument Public Sub New(uidoc As UIDocument) m_uidoc = uidoc InitializeComponent() End Sub Private Sub Form1Load(sender As Object, e As EventArgs) Dim doc As Document = m_uidoc.Document Dim collector As New FilteredElementCollector(doc) collector.OfClass(GetType(ViewSheet)) For Each vs As ViewSheet In collector Dim vNumber As String = vs.SheetNumber If vs.Name = doc.ActiveView.Name Then comboBox1.Items.Add(vNumber & "_" & vs.Name) End If Next End Sub End Class
ThisDocument:
Public Sub ComboBoxForm() Dim dialog As New Form1(Me) dialog.ShowDialog() If dialog.DialogResult = DialogResult.Cancel Then Return End If End Sub
P.S. I converted the code from C# to VB.NET.
Regards,
Thank you
but I had to adjust the code
being of the following way:
for ThisDocument
regards.