dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: OnLoad Method

  1. #1
    Join Date
    Jun 2016
    Posts
    8

    OnLoad Method

    I am new to C# and trying to get an openGL program working. One of the calls I need to make is OnLoad to set something up for the OpenGL environment. However, I get a message from VisualStudio 2015 that it can't find the OnLoad method to overload it. Am I possibly missing a using statement?

    Andy Cruce

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,002

    Re: OnLoad Method

    What kind of C# project are you working in?

  3. #3
    Join Date
    Jun 2016
    Posts
    8

    Re: OnLoad Method

    I am using directions I found on http://neokabuto.blogspot.com/2013/0...ndows-and.html to get up an running with OpenGl. I am starting a home project to record, display and analyze aerobatic maneuvers. Tinker forge has USB based GPS and IMU hardware that I can use to get the airplane dynamics. I am retired and trying to come up to speed on C#, .net and OpenGL after having not done any programming over the past several decades. Here is the simple code I am using. Prior to adding the OnLoad statement the code did open a window. I added the OnLoad as shown and get a "namespace cannot directly contain members such as fields or methods. I know this should be trivial but I'm having trouble seeing the forest for the trees.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web;
    using OpenTK;


    protected override void OnLoad(EventArgs e)
    {
    }



    namespace OpenTKTutorial
    {
    class Game: GameWindow
    {
    }
    }


    namespace OpenTKTutorial
    {
    class Program
    {

    static void Main(string[] args)
    {
    using (GameWindow game = new Game())
    {
    game.Run(30.0);
    }
    }
    }

    Thanks for any help you can provide.

  4. #4
    Join Date
    May 2002
    Posts
    511

    Re: OnLoad Method

    Your OnLoad() method needs to be part of a class. I would think in this case your Game class.

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




On-Demand Webinars (sponsored)