mardi 31 mars 2020

Error CS0120 : I'm trying to make a label text change every X seconds

so basically the problem is that i am trying to make a "fake" and trolling program that considers to fix Visual Studio 2019 for my friend (he wants this idk why). Here's the code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VS_Error_Checker
{

    public partial class Form2 : Form
    {

        private System.Windows.Forms.Timer x = new Timer();
        public event EventHandler Tick;

        public Form2()
        {
            InitializeComponent();



        }


        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            x.Tick += new EventHandler(TimerEventProcessor);

            label1.Text = "Corrupted Files : 15";
            x.Interval = 3000;
            label1.Text = "Corrupted Files : 34";
            x.Interval = 1500;
            label1.Text = "Corrupted Files : 40";
            x.Interval = 1500;
            label2.Text = "Corrupted registry keys : 15";
            x.Interval = 1500;
            label2.Text = "Corrupted registry keys : 27";
            x.Interval = 900;

            label3.Text = "Non-downloaded files : 14";

        }
        private static void TimerEventProcessor(Object myObject, EventArgs myEventArgs)
        {
            x.Stop();
        }
            private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.Increment(1);

        }

    }
}

please help, i really need help because i am working on some others projects that uses the same code :(

Aucun commentaire:

Enregistrer un commentaire