ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about propertyEditor

Can I use propertyEditor to change the property of a control on another form?

For example, there is a waveformgraph on form1 and a propertyEditor on form2. Can I change the property of waveformgraph through propertyEditor?

Thank you!
0 Kudos
Message 1 of 4
(3,683 Views)
Yes, as long as you have a reference to the waveformgraph in form1 from form2. You can do something like:

propertyEditor.Source = new PropertyEditorSource(form1.waveformgraph, "Caption");

Message Edited by Abhishek Ghuwalewala on 06-22-2006 12:38 PM

Abhishek Ghuwalewala | Measurement Studio | National Instruments
Message 2 of 4
(3,656 Views)

    I find it difficult to get a reference of a control on another form. Can you give me an example?

    Thank you!

 

    Best Regards,

    Wei Zhang

0 Kudos
Message 3 of 4
(3,638 Views)
You will need to create a property on your other form in order to access the control. For example, in Form1 class you will need to declare something like this:

public class Form1
{
...

    public WaveformGraph WaveformGraph
    {
       get
       {
          return waveformGraph;
       }
    }
}

Now, in Form2, if you have reference to a Form1 object called form1, then you can write:

this.propertyEditor.Source = new PropertyEditorSource(form1.WaveformGraph, "Caption");


Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 4 of 4
(3,635 Views)