Calling methods on unnamed objects
Hello,
We are building a graphing application in which we define the different components of the form as user controls.
We have defined a number of series on the graph such as bar, candlesticks, line etc. and at a time, only one series is visible on the graph. The user selects a radio button and based on the selection, one of the series is made visible and the others are disabled.
The problem we are facing is that we are unable to access the method defined for disabling/enabling a series in the class for creating the chart as there is no way to reference the object created at run-time for the chart.
We are coding in Visual Studio.
What can be done to call methods in run-time objects which cannot be referenced?
Thanks.
Re: Calling methods on unnamed objects
if you mean late binding then Using Type dynamic (C# Programming Guide) might help you
Re: Calling methods on unnamed objects
Quote:
The problem we are facing is that we are unable to access the method defined for disabling/enabling a series in the class for creating the chart as there is no way to reference the object created at run-time for the chart.
Huh? Of course there is. When you create it, save it as an instance level variable.
Re: Calling methods on unnamed objects
When you create an object dont you create it like so:
Object obj = new Object(); ?
You would be able to reference this object by
using the name obj example obj.Dispose();
Re: Calling methods on unnamed objects
You can create instance of usercontrols and then access the public method of those usercontrols.