Click here to Skip to main content
15,920,602 members
Home / Discussions / C#
   

C#

 
Question"dataGrid",No one can Help?? Pin
Anonymous16-Jul-03 23:31
Anonymous16-Jul-03 23:31 
GeneralHashtable question Pin
Venkatraman16-Jul-03 23:06
Venkatraman16-Jul-03 23:06 
GeneralRe: Hashtable question Pin
Arjan Einbu17-Jul-03 0:16
Arjan Einbu17-Jul-03 0:16 
GeneralRe: Hashtable question Pin
Frank Olorin Rizzi17-Jul-03 5:13
Frank Olorin Rizzi17-Jul-03 5:13 
GeneralRe: Hashtable question Pin
Jim Stewart17-Jul-03 5:14
Jim Stewart17-Jul-03 5:14 
GeneralRe: Hashtable question Pin
Arun Bhalla22-Jul-03 15:16
Arun Bhalla22-Jul-03 15:16 
GeneralAssigning text or name of button to variable Pin
eggie516-Jul-03 22:38
eggie516-Jul-03 22:38 
GeneralRe: Assigning text or name of button to variable Pin
fool16-Jul-03 23:39
fool16-Jul-03 23:39 
Hi eggie5,

1. set each button's Tag property to the appropriate number
2. create only one callback method for all button's click event and assign it
3. use the sender object to get the Tag property's value

C#
// step 1 - alternatively do this within the designer
// private void InitializeComponent()
// {
	// ...
	this.button1.Tag = 1;
	this.button2.Tag = 2;
	this.button3.Tag = 3;
	this.button4.Tag = 4;
	this.button5.Tag = 5;
	this.button6.Tag = 6;
	this.button7.Tag = 7;
	// ...
// }

C#
// step 2 - alternatively do this within the designer
// private void InitializeComponent()
// {
	// ...
	this.button0.Click += new System.EventHandler(ClickHandler);
	this.button1.Click += new System.EventHandler(ClickHandler);
	this.button2.Click += new System.EventHandler(ClickHandler);
	this.button3.Click += new System.EventHandler(ClickHandler);
	this.button4.Click += new System.EventHandler(ClickHandler);
	this.button5.Click += new System.EventHandler(ClickHandler);
	this.button6.Click += new System.EventHandler(ClickHandler);
	this.button7.Click += new System.EventHandler(ClickHandler);
	// ...
// }

C#
private void ClickHandler(object sender, EventArgs ea)
{
	// step 3
	short nOutNum = (short) ((Control)sender).Tag;
	NTPort.Outport(nAddress, (short)nOutNum);	
}


Have fun,
Dave
GeneralRe: Assigning text or name of button to variable Pin
eggie517-Jul-03 10:48
eggie517-Jul-03 10:48 
GeneralConvert HDIB to Bitmap, so close and yet so far Pin
Brendan Tregear16-Jul-03 22:29
Brendan Tregear16-Jul-03 22:29 
GeneralRe: Convert HDIB to Bitmap, so close and yet so far Pin
Stephane Rodriguez.17-Jul-03 3:23
Stephane Rodriguez.17-Jul-03 3:23 
GeneralRe: Convert HDIB to Bitmap, so close and yet so far Pin
J. Dunlap17-Jul-03 8:23
J. Dunlap17-Jul-03 8:23 
GeneralRe: Convert HDIB to Bitmap, so close and yet so far Pin
J. Dunlap17-Jul-03 8:22
J. Dunlap17-Jul-03 8:22 
GeneralRe: Convert HDIB to Bitmap, so close and yet so far Pin
Brendan Tregear17-Jul-03 16:01
Brendan Tregear17-Jul-03 16:01 
GeneralIs that possible Pin
Kerad16-Jul-03 22:18
Kerad16-Jul-03 22:18 
GeneralRe: Is that possible Pin
leppie17-Jul-03 7:23
leppie17-Jul-03 7:23 
GeneralGDI+ help Pin
r916-Jul-03 21:36
r916-Jul-03 21:36 
GeneralRe: GDI+ help Pin
r916-Jul-03 23:01
r916-Jul-03 23:01 
GeneralRe: GDI+ help Pin
J. Dunlap17-Jul-03 8:07
J. Dunlap17-Jul-03 8:07 
GeneralRe: GDI+ help Pin
r917-Jul-03 22:55
r917-Jul-03 22:55 
GeneralRe: GDI+ help Pin
J. Dunlap18-Jul-03 11:38
J. Dunlap18-Jul-03 11:38 
GeneralRe: GDI+ help Pin
r918-Jul-03 12:22
r918-Jul-03 12:22 
GeneralFunction Keys Pin
Riaan van der Westhuizen16-Jul-03 20:40
Riaan van der Westhuizen16-Jul-03 20:40 
GeneralRe: Function Keys Pin
fool16-Jul-03 23:55
fool16-Jul-03 23:55 
GeneralRe: Function Keys Pin
Jim Stewart17-Jul-03 5:18
Jim Stewart17-Jul-03 5:18 

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.