Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Transferring a variable to a form

Posted on 2010-11-15
2
Medium Priority
?
236 Views
Last Modified: 2012-06-27
I have a variable that is declared at execution. I need to get that variable into my form so I can access it. The variable I need is commandData. I cannot declare it public because the value is set at execution. Is there a way to pass a variable to a form? the only thing I can find is from one form to another. Here is the code:

 Public Function Execute(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Autodesk.Revit.UI.Result Implements Autodesk.Revit.UI.IExternalCommand.Execute
        Dim fm1 As New ContentBrowser()
        Dim components = New Container()
        Dim resources As New ResourceManager(GetType(ContentBrowser))
        Dim tabControl1 As New TabControl()
        Dim tabPage1 As New TabPage()
        Dim myImages As New ImageList(components)
        ' Construct the ImageList.
        Dim ImageList1 = New ImageList
        fm1.Show()
    End Function
0
Comment
Question by:mgsell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 34141269
Sure you can...but your form needs a place to store it!

So you could either:
(1) Override the constructor so the value is received when you create a new instance of the form.
(2) Add a public member (or a private with a public property wrapper).

In either case, you need to add a variable of type Autodesk.Revit.UI.ExternalCommandData to the form:

    Public Class ContentBrowser

        Public CommandData As Autodesk.Revit.UI.ExternalCommandData

    End Class

Simple example of #2:

    Dim fm1 As New ContentBrowser()
    fm1.CommandData = commandData
    ...
0
 

Author Comment

by:mgsell
ID: 34146010
That worked perfectly!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question