Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 3 odgovora
  • 3.404 pregleda

Najnovija ↓

Problem sa Timer-a u VS2010 06.10.2011. u 13:39 · pre 183 meseca #1
Vako, dolu navedzeni kod u C# mi vadzi gresku u VS2010, ranije u vs2008 ovo radilo bes greske, sta e problem?

"Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement Line 23 17"
"Error 2 Only assignment, call, increment, decrement, and new object expressions can be used as a statement Line 27 17"

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

namespace WindowsFormsApplication9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (timer1.Enabled == false)
            {
                timer1.Enabled == true;
            }
            else
            {
                timer1.Enabled == false;
            }
        }
    }
}
Re: Problem sa Timer-a u VS2010 06.10.2011. u 13:49 · pre 183 meseca #3
Citat:
ha_23: Vako, dolu navedzeni kod u C# mi vadzi gresku u VS2010, ranije u vs2008 ovo radilo bes greske, sta e problem?

"Error1Only assignment, call, increment, decrement, and new object expressions can be used as a statement Line 2317"
"Error2Only assignment, call, increment, decrement, and new object expressions can be used as a statement Line2717"

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

namespace WindowsFormsApplication9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (timer1.Enabled == false)
            {
                timer1.Enabled == true;
            }
            else
            {
                timer1.Enabled == false;
            }
        }
    }
}



if (timer1.Enabled == false)
{
timer1.Enabled == true;
}
else
{
timer1.Enabled == false;
}
ne moze, u bloku od if-a i else-a , da stoji ' == ' (znaci, ispravno je: 'timer1.Enabled = true', a ne 'timer1.Enabled == true')?
Nije ovo moglo, nikako, da radi ni u jednoj verziji Visual Studio-a (ni 2005, ni 2008, ...) ...
Potpis
Programming is fun, but writing good software is hard ...
Re: Problem sa Timer-a u VS2010 06.10.2011. u 13:54 · pre 183 meseca #4
Tako e pronaso sam gresku, napisao == umesto =, kako nisam zaprimetio :)
Pozdarv :)
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme