How can I Programmatically Set the Range of a Measurement Studio Control?Primary Software: Measurement Studio>>Measurement Studio for .NET SupportPrimary Software Version: 8.6 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I would like to change the range of a Measurement Studio object, such as a thermometer or graph programmatically, but when I try to set the value, my code does not compile. Currently, I am using this syntax: myControl.Range.Maximum = 0; When I compile this code, I get the following error: Property or indexer 'NationalInstruments.UI.Range.Maximum' cannot be assigned to - it is read only How can I set the range without getting errors?Solution: This error occurs because it is necessary to use the constructor when setting a range value. This is done using code similar to the following: myControl.Range = new NationalInstruments.UI.Range(minValue, maxValue); This code creates a new range object for the control, and assigns the object with the specified minimum and maximum. If you only want to modify the maximum or minimum, but not both, use the range property as the parameter for the range object, as shown here: myControl.Range = new NationalInstruments.UI.Range(minValue, myControl.Range.maximum);Related Links: KnowledgeBase 4UHGSC5F: Automatically Scaling the Measurement Studio Scatter Graph Y-Axis when the X-Axis Range is Changed Attachments:
Report Date: 06/23/2009 Last Updated: 08/25/2009 Document ID: 4YMDLCUB |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
