FormClosingEventHandler C#

Zanima me, zakaj mi noče delati event handler v podani kodi, ali je event handler pravilno deklariran in če ni me zanima kako bi ga moral deklarirati glede na kodo.

private void button2_Click(object sender, EventArgs e)
        {
            //urejanje storitev
            string naziv="", opis="";
            int id=1;
            double postavka = 0 ;

            foreach (DataGridViewRow vrstica in dataGridView1.SelectedRows)
            {
                id = int.Parse(vrstica.Cells[0].Value.ToString());
                naziv = vrstica.Cells[1].Value.ToString();
                postavka = double.Parse(vrstica.Cells[2].Value.ToString());
                opis = vrstica.Cells[3].Value.ToString();
            }
            UrediStoritev uredi = new UrediStoritev(id, naziv, postavka, opis);
            uredi.ShowDialog();
            uredi.FormClosing += new FormClosingEventHandler(UrediStoritev_Closing);
           
        }

Avtor: Mravbar, objavljeno na portalu SloDug.si (Arhiv)

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.

AndrejT
AndrejT - sreda, 16. september 2009

Handler določaš šele po odpiranju dialoga. Vrstico s ShowDialog() prestavi na konec.