ciao|
ho un problema usando i delegati...
ho questo codice:
dove nella label digital dovrebbe apparire l'ora...codice:#region Using directives using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; #endregion namespace Delegates { partial class Form1 : Form { public Form1() { InitializeComponent(); //clock = new Clock(digital); pulsed = new Ticker(); } private void start_Click(object sender, System.EventArgs e) { //this.clock.Start(); pulsed.tick += new Ticker.Tick(pulsed_tick); } void pulsed_tick(int hh, int mm, int ss) { string ora = string.Format("{0:D2}:{1:D2}:{2:D2}", hh, mm, ss); this.digital.Text = ora; //throw new Exception("The method or operation is not implemented."); } private void stop_Click(object sender, System.EventArgs e) { //this.clock.Stop(); pulsed.tick -= new Ticker.Tick(pulsed_tick); } private Ticker pulsed; //private Clock clock; } }
allora, la stringa ora è ok, mentre quando tenta di scrivere sulla label (riga sotto) si schianta!
che devo fare??
tnx!![]()

Rispondi quotando