Click here to Skip to main content
15,892,643 members
Home / Discussions / C#
   

C#

 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 3:52
nstk14-Feb-11 3:52 
AnswerRe: Simple calculator Pin
DaveyM6912-Feb-11 12:22
professionalDaveyM6912-Feb-11 12:22 
AnswerRe: Simple calculator Pin
Luc Pattyn12-Feb-11 18:04
sitebuilderLuc Pattyn12-Feb-11 18:04 
GeneralRe: Simple calculator Pin
DaveyM6913-Feb-11 2:48
professionalDaveyM6913-Feb-11 2:48 
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 
I am working in c#. I want to change the colour of button by applying function of timer but is giving error.Can any one solve this problem?? 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();
        }

        [STAThread]
        static void Main()
        {
            
            Application.Run(new Form1());
        }
    }
}



Error:


Error 1 Program 'C:\Documents and Settings\XPPRESP3\Local Settings\Application Data\Temporary Projects\WindowsApplication1\obj\Debug\WindowsApplication1.exe' has more than one entry point defined: 'WindowsApplication1.Form1.Main()' C:\Documents and Settings\XPPRESP3\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.cs 40 21 WindowsApplication1
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 
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 

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.