Calling methods on unnamed objects
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Calling methods on unnamed objects

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    3

    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.

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Calling methods on unnamed objects

    if you mean late binding then Using Type dynamic (C# Programming Guide) might help you
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Calling methods on unnamed objects

    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.

  4. #4
    Join Date
    Nov 2010
    Posts
    42

    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();

  5. #5
    Join Date
    Dec 2010
    Posts
    12

    Re: Calling methods on unnamed objects

    You can create instance of usercontrols and then access the public method of those usercontrols.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center