Click here to Skip to main content
15,886,861 members
Home / Discussions / C#
   

C#

 
GeneralRe: Opening a specified folder; double-clickon system tray icon Pin
mav.northwind25-Apr-05 20:24
mav.northwind25-Apr-05 20:24 
GeneralExport generated data to database. Pin
StoneWolfSoft25-Apr-05 5:22
StoneWolfSoft25-Apr-05 5:22 
GeneralObject reference not set to an instance of an object. On Marshal.PtrToStructure Method Pin
mrxero25-Apr-05 4:44
mrxero25-Apr-05 4:44 
GeneralSaving socket connection information Pin
CheckDude25-Apr-05 4:27
CheckDude25-Apr-05 4:27 
GeneralRe: Saving socket connection information Pin
S. Senthil Kumar26-Apr-05 2:31
S. Senthil Kumar26-Apr-05 2:31 
GeneralRe: Saving socket connection information Pin
CheckDude10-May-05 5:59
CheckDude10-May-05 5:59 
GeneralGet Button Pin
The underdog25-Apr-05 2:51
The underdog25-Apr-05 2:51 
GeneralRe: Get Button Pin
Ashok Dhamija25-Apr-05 3:29
Ashok Dhamija25-Apr-05 3:29 
Have a common (i.e., the same) event-handler for all the buttons on your form, say ButtonClick. Implement this common event-handler as under, for example:
private void ButtonClick(object sender, System.EventArgs e)
		{
			if((Button)sender == button1)
			{
				button1.BackColor = Color.Green;
				MessageBox.Show("button1 was clicked", "Form1");
			}
			else if((Button)sender == button2)
			{
				button2.BackColor = Color.Pink;
				MessageBox.Show("button2 was clicked", "Form1");
			}
			else if((Button)sender == button3)
			{
				button3.BackColor = Color.Blue;
				MessageBox.Show("button3 was clicked", "Form1");
			}
			else if((Button)sender == button4)
			{
				button4.BackColor = Color.Yellow;
				MessageBox.Show("button4 was clicked", "Form1");
			}
		}

It works properly and identifies the correct button pressed. You can add your own code in place of the sample code above. If the number of buttons is too large, you can even consider having an ArrayList of the buttons.
GeneralRe: Get Button Pin
Le centriste25-Apr-05 3:46
Le centriste25-Apr-05 3:46 
GeneralRe: Get Button Pin
mav.northwind25-Apr-05 3:52
mav.northwind25-Apr-05 3:52 
GeneralRe: Get Button Pin
Luis Alonso Ramos25-Apr-05 5:49
Luis Alonso Ramos25-Apr-05 5:49 
GeneralDiferences between null,close and dispose Pin
Enishi25-Apr-05 1:48
Enishi25-Apr-05 1:48 
GeneralRe: Diferences between null,close and dispose Pin
S. Senthil Kumar25-Apr-05 3:32
S. Senthil Kumar25-Apr-05 3:32 
GeneralRe: Diferences between null,close and dispose Pin
turbochimp25-Apr-05 5:54
turbochimp25-Apr-05 5:54 
GeneralRe: Diferences between null,close and dispose Pin
S. Senthil Kumar25-Apr-05 19:22
S. Senthil Kumar25-Apr-05 19:22 
GeneralRe: Diferences between null,close and dispose Pin
mav.northwind25-Apr-05 20:27
mav.northwind25-Apr-05 20:27 
GeneralRe: Diferences between null,close and dispose Pin
S. Senthil Kumar26-Apr-05 0:33
S. Senthil Kumar26-Apr-05 0:33 
GeneralRe: Diferences between null,close and dispose Pin
turbochimp26-Apr-05 5:10
turbochimp26-Apr-05 5:10 
GeneralRe: Diferences between null,close and dispose Pin
S. Senthil Kumar26-Apr-05 19:17
S. Senthil Kumar26-Apr-05 19:17 
GeneralRe: Diferences between null,close and dispose Pin
turbochimp27-Apr-05 5:19
turbochimp27-Apr-05 5:19 
GeneralRe: Diferences between null,close and dispose Pin
Tom Larsen25-Apr-05 9:31
Tom Larsen25-Apr-05 9:31 
GeneralRe: Diferences between null,close and dispose Pin
Enishi25-Apr-05 22:08
Enishi25-Apr-05 22:08 
GeneralCopy an excel document Pin
fatihsen25-Apr-05 1:34
fatihsen25-Apr-05 1:34 
GeneralRe: Copy an excel document Pin
turbochimp25-Apr-05 2:49
turbochimp25-Apr-05 2:49 
General[ActiveDirectory] Connect to group Pin
Jaymz66625-Apr-05 1:05
Jaymz66625-Apr-05 1:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.