ciao raga...
vado avanti con lo studio ,adesso tento di intercettare gli eventi di tipo click
in vbnet mi basta usare sender.name ,e risolvo ma in c#?
ciao a tutti .
codice: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 WindowsFormsApplication4 { public partial class Form1 : Form { public Form1() { InitializeComponent(); lancia_bottoni(); } public void lancia_bottoni(){ int assex = 20; Button[] xbot = new System.Windows .Forms .Button[10] ; for(int giro=0;giro<10;giro++){ xbot[giro] = new Button(); xbot[giro].Click += new System.EventHandler(this.xbot_clik); xbot[giro].Location = new System.Drawing.Point (assex, 20); xbot[giro].Name = giro.ToString() ; xbot[giro].Size = new System.Drawing .Size(20, 20); xbot[giro].Visible = true; assex = assex + 30; this.Controls.Add(xbot[giro]); } } private void xbot_clik(object sender,EventArgs e ) { this.Text = sender.ToString () ; <--- ecco qui vorrei come output il nome del tasto premuto } private void Form1_Load(object sender, EventArgs e) { } } }

Rispondi quotando