Hi
try this
in the form designer set the click event for both buttons to the same function; in this case 'button_Click'
then do this in the formCode:this.button6.Location = new System.Drawing.Point(243, 85); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(85, 29); this.button6.TabIndex = 6; this.button6.Text = "button6"; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button_Click); // // button7 // this.button7.Location = new System.Drawing.Point(342, 84); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(79, 29); this.button7.TabIndex = 7; this.button7.Text = "button7"; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.button_Click);
Hope this helpsCode:private void button_Click(object sender, EventArgs e) { if (sender == button6) MessageBox.Show (sender.ToString()); else if ( sender == button7 ) MessageBox.Show (sender.ToString()); }
Curt




Reply With Quote