07-23-2007 06:12 AM
{ cbLineStyle.Items.Add(style);}
cbLineStyle.SelectedIndex = 5;
If I select an item in the combobox I get the line style returned as a string. This is fine to write to the registry.
My problem is how to use the string to set the LineStyle property.
1. Can anyone help me?
2. Can anyone suggest a good reference source for MStudio. I confess that I find the help system rather unhelpful!![]()
Many thanks
John 822179
Live long, prosper and understand Measurement Studio?
07-23-2007 08:49 AM - edited 07-23-2007 08:49 AM
Hi John,
There is a much easier solution for what you are trying to do. We have PropertyEditor controls that allow you to edit properties of an object at run-time. In your case, you could set the PropertyEditor control to allow you to set the LineStyle property of a WaveformPlot object at runtime. You simply drop down the PropertyEditor control from the Toolbox, right-click the control and select Edit Source, and then choose your Object and Property Name. In this case, you would select waveformPlot1 (unless you changed the name of your plot as this is the default) for the Object and LineStyle for the Property Name. See screenshot Property Editor Source Editor.
You would then have a nice drop-down box to select from. See attached Example screenshot and the small example. Use this method when trying to set properties at run-time. We also have an PropertyEditor example that you should look at under the examples <MeasurementStudioVS2005>\DotNET\Examples\UI\WindowsForms\PropertyEditor.
To address your second question, I would suggest checking out our Using Measurement Studio .NET Class Libraries topics under NI Measurement Studio Help >> NI Measurement Studio .NET Class Library >> Using the Measurement Studio .NET Class Libraries. Then check out the Using the Measurement Studio Windows Forms .NET Controls.
If you have any suggestions on how to improve our help, or areas that you see we are weak in, please let me know by submitting a product suggestion.
Best Regards,
Message Edited by Jonathan N on 07-23-2007 08:50 AM
07-23-2007 10:49 AM
07-24-2007 03:40 AM
Hi Jonathan,
Thanks for your excellent, detailed reply.
I am sure that I will use the Property editor in the future, but for the current application, I will stick with what I am doing.
I will spend some time over the few days and let you have a product suggestion regarding the help system.
Many thanks
John 822179
Live long, propser and understand C#?
07-24-2007 03:50 AM
Hi Abhishek,
Thanks for your reply.
I had found Enum.Parse, but not EnumObject.Parse.
My other problem was understanding how to use it, once I knew it existed!
Searching for EnumObject in the help system didn't help too much. Yes, it is there, but what is there didn't prepare me for what I needed to do to use it!![]()
After searching MSDN for Enum.Parse, and doing a bit of COLUMBOing, I eventually created the following line of code:
waveformPlot1.LineStyle = (
LineStyle)EnumObject.Parse(typeof(LineStyle), Convert.ToString( cbLineStyle.SelectedItem ));Phew, I hope that I can find this again when I need it!!![]()
Many thanks for your help,
John822179
Live long, prosper and understand Measurment studio?