I need the possibility to pick element(s) in Revit GUI from a Windows From that ist shown with showdialog.
Eveything is working fine from inside the form to make changes to the revit database with transactions.
But still found no way to allow the user to click elements in the GUI.
Testcode which should allow the user to pick an element an then find the ID in an datagrid on the form
Private Sub cmdMEP_RaumSuchen_Click(sender As Object, e As EventArgs) Handles cmdMEP_RaumSuchen.Click
Me.Hide()
Dim rvtElementRef As Reference
rvtElementRef = m_rvtUidoc.Selection.PickObject(ObjectType.Element, "MEP-Raum wählen")
Dim rvtElement As Element
rvtElement = m_rvtDoc.GetElement(rvtElementRef.ElementId)
Me.ShowDialog()
Dim Row As DataGridViewRow
For Each Row In dbgRaumbuch.Rows
If Row.Cells("MepID").Value.ToString = rvtElement.Id.ToString Then
Row.Selected = True
End If
Next
End Sub
Would be nice if anyone can help me