Click here to Skip to main content
15,921,279 members
Home / Discussions / C#
   

C#

 
AnswerRe: Simple calculator Pin
Luc Pattyn13-Feb-11 3:01
sitebuilderLuc Pattyn13-Feb-11 3:01 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 10:21
nstk14-Feb-11 10:21 
AnswerRe: Simple calculator Pin
RichardGrimmer15-Feb-11 3:58
RichardGrimmer15-Feb-11 3:58 
Questionerror in timer function Pin
aeman12-Feb-11 4:40
aeman12-Feb-11 4:40 
AnswerRe: error in timer function Pin
Manfred Rudolf Bihy12-Feb-11 5:10
professionalManfred Rudolf Bihy12-Feb-11 5:10 
GeneralRe: error in timer function Pin
aeman12-Feb-11 6:25
aeman12-Feb-11 6:25 
AnswerRe: error in timer function Pin
OriginalGriff12-Feb-11 5:20
mveOriginalGriff12-Feb-11 5:20 
GeneralRe: error in timer function Pin
aeman12-Feb-11 20:07
aeman12-Feb-11 20:07 
Thanks but after removing the main function it is still giving me the following errors:

Here is the code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        System.Timers.Timer greentimer;
        System.Timers.Timer redtimer;

        public Form1()
        {
            InitializeComponent();
            greentimer = System.Timers.Timer(3000);
            greentimer.Elapsed += new System.Timers.ElapsedEventHandler(greenTimer_Elapsed);
            greentimer.Start();

            redtimer = System.Timers.Timer(3000);
           redtimer.Elapsed += new System.Timers.ElapsedEventHandler(redTimer_Elapsed);
            redtimer.Start();

        }
        void redTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
             button1.Invoke(new Action(() => button1.BackColor=Color.Green));

        }
        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        
    }
}





Errors:



Error 1 Invalid expression term ')' C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 41 WindowsApplication2



Error 2 Invalid expression term '>' C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 44 WindowsApplication2


Error 3 ) expected C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 46 WindowsApplication2



Error 4 ; expected C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 75 WindowsApplication2



Error 5 Invalid expression term ')' C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 75 WindowsApplication2



Error 6 ; expected C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 30 76 WindowsApplication2




Error 8 'System.Timers.Timer' is a 'type', which is not valid in the given context C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 19 40 WindowsApplication2



Error 9 The name 'greenTimer_Elapsed' does not exist in the current context C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 20 73 WindowsApplication2



Error 10 'System.Timers.Timer' is a 'type', which is not valid in the given context C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 23 38 WindowsApplication2



Error 11 'WindowsApplication1.Form1' is a 'type' but is used like a 'variable' C:\Documents and Settings\XPPRESP3\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs 42 30 WindowsApplication2
AnswerRe: error in timer function Pin
OriginalGriff12-Feb-11 21:34
mveOriginalGriff12-Feb-11 21:34 
AnswerRe: error in timer function Pin
Henry Minute12-Feb-11 6:07
Henry Minute12-Feb-11 6:07 
AnswerRe: error in timer function Pin
Luc Pattyn12-Feb-11 6:14
sitebuilderLuc Pattyn12-Feb-11 6:14 
GeneralRe: error in timer function Pin
Henry Minute12-Feb-11 6:34
Henry Minute12-Feb-11 6:34 
GeneralRe: error in timer function Pin
Luc Pattyn12-Feb-11 6:42
sitebuilderLuc Pattyn12-Feb-11 6:42 
AnswerRe: error in timer function Pin
_Erik_14-Feb-11 3:42
_Erik_14-Feb-11 3:42 
Questioncapture finger print continuously Pin
s_akram12-Feb-11 3:12
s_akram12-Feb-11 3:12 
AnswerRe: capture finger print continuously Pin
Henry Minute12-Feb-11 3:20
Henry Minute12-Feb-11 3:20 
Questioncapture finger print continuously Pin
s_akram12-Feb-11 3:09
s_akram12-Feb-11 3:09 
AnswerRe: capture finger print continuously Pin
Dave Kreskowiak12-Feb-11 3:56
mveDave Kreskowiak12-Feb-11 3:56 
QuestionCould not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Marat Beiner12-Feb-11 2:34
Marat Beiner12-Feb-11 2:34 
AnswerRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Henry Minute12-Feb-11 3:21
Henry Minute12-Feb-11 3:21 
GeneralRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Marat Beiner12-Feb-11 6:20
Marat Beiner12-Feb-11 6:20 
GeneralRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Henry Minute12-Feb-11 6:32
Henry Minute12-Feb-11 6:32 
GeneralRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT [modified] Pin
Marat Beiner12-Feb-11 8:32
Marat Beiner12-Feb-11 8:32 
GeneralRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Henry Minute12-Feb-11 8:58
Henry Minute12-Feb-11 8:58 
GeneralRe: Could not load file or assembly or one of its dependencies. The given assembly name or codebase was invalid. exception from HRESULT Pin
Marat Beiner12-Feb-11 9:10
Marat Beiner12-Feb-11 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.