'GadgeteerApp1.Program' does not contain a definition for 'ProgramStarted'

I keep getting this error when I try and run the push button to light led.
The code is exactly the same as Pete Browns Getting started.
The device is connected and running, once Iv no button push in the code.

Iv re-installed all the required packs. But it looks like Im still missing something.

Any help would be great

Did you use the Visual Studio Gadgeteer template to create your project? If so, this includes the ProgramStarted() function in Program.cs. The call to this function is autogenerated and lives in Main() in Program.generated.cs. Do not alter this latter file. Program.cs should look something like the following:


using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp1
{
    public partial class Program
    {
        void ProgramStarted()
        {
            /******************************************************************************************
            Access modules defined in the designer by typing their name:                            
            
            e.g.  button
                  camera1

            Initialize event handlers here.
            e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);             
            ***************************************************************************************** */

            // Do one-time tasks here
            Debug.Print("Program Started");
        }
    }
}


Woo fast reply. Tks
To answer your question the project is taken from the Gadgeteer template.
I just tried re doing the project from the start but I got the same error.

Does ‘redo’ mean adding Pete’s code? I suggest just creating the template and deploying without any code added. You should at least get the debug statement in the output window. If that doesn’t work, something is wrong with your VS template.

Good Idea.
And I even got a result.

An unhandled exception of type ‘System.NullReferenceException’ occurred in Microsoft.SPOT.TinyCore.dll

Now Im even more confused because Iv used the template to do some simple graphics and it has worked.
So is the template wrong or is there another problem :

Did you have any issues when running through the SDK install(s) for Gadgeteer? The install app that GHI provided does a good job of checking to make sure you’ve got all the right pieces installed in the right order.

My bet is on “other problem”, but I’m not sure what. Maybe try reinstalling the SDKs.

Good Question :smiley:
The install app did not work for me. It could not find the XML data.
So I installed manually. I also tried donloading and installing again but the app still would not work.

did you install by opening the zip file in windows explorer? If so, unzip it first, the run the installer

All files were unziped.
Setup would not run.
Error:- cannot find xml data

You need to unzip files as is and you not have any problems

I got the setup files to work correctly, but still had the same problem.
However I noticed the namespace names were different on the program.cs and the generated.cs.
I corrected this problem. Now I keep ketting “led Not supported in dll file” and the same for button.

Im going to setup system on my laptop and see if that works. Ill let you know the result. ;D

System setup on laptop.
Im still getting exactly the same error.
An unhandled exception of type ‘System.NullReferenceException’ occurred in Microsoft.SPOT.TinyCore.dll

I get the same error on both computers.

Over a week of programming ad I still cant get a simple program to work.

Anyone any ideas before I give up
Program is:-
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp3
{

public partial class Program
{


    void ProgramStarted()
    {


        button.ButtonPressed += (s, ea) =>
        {
            led.BlinkOnce(GT.Color.Blue);
        };
    }
}

}

Can you make a new project with a very simple code, like this:


using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp1
{
    public partial class Program
    {
        void ProgramStarted()
        {
            Debug.Print("Program Started");
            led.TurnBlue();
        }
    }
}

Beside, take a look on your MultiLED module, it has “XY*” and “" socket, make sure that the socket "XY” is connected to mainboard.

And also, usually when an exception is thrown, the program will stop at a breakpoint , what the breakpoint did you see?

Double click on “Program.generated.cs”, go to

[Code]
private void InitializeModules()
{
// Initialize GTM.Modules and event handlers here.
led = new GTM.GHIElectronics.MulticolorLed(8);

    }


You will be received Null exception if don't have "led =new GTM.GHIElectronics.MulticolorLed(x)"

I tried your suggestion and it worked.
So I tried the blinking led. It dident work. I tried again and again and it worked.
Anyway to keep a long story short
Is it important to reset the Gageteer before you download software to it.
I found after writing a new project I needed to disconnect device. Reconnect download and when that failed reset device. Then providing there were no errors It would work.

Am I still Missing something?

Having good power source is a key component here. Read more here please http://wiki.tinyclr.com/index.php?title=Gadgeteer

is it possible this is a tight-loop problem where the debugger / deployment fails to connect to the board? thread.sleep(timeout.infinite) at the end of your app might help, but perhaps Gadgeteer already does that?