• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

Event Handling with an array of TextBoxes


hello, i'm new to forms and am having some difficulties.  Basically my situation is that i have a 2 dimensional array of TextBoxes, and for each one i need to have an event, so for instance:

TextBox[,] TextArray = new TextBox[10,10];
for(int i=0; i<10; i++)
{
  for(int j=0; j<10; j++)
  {
    this.TextArray[i,j].MouseEnter += new System.EventHandler(this.comp_Hover);
  }
}

the problem is, the comp_Hover method has no idea which TextBox triggered the event, i need some way to convey the information that it was specifically TextArray[i,j] which triggered the event, and i dont know how to do this. Any Suggestions??
Thanks for any help...
0
saneman
Asked:
saneman
1 Solution
 
AlexFMCommented:
The first parameter of comp_Hover function is object sender. This is textbox which triggers event:

if ( sender == TextArray[0][0] )
    // 0, 0 is sendre
...

0
 
sanemanAuthor Commented:
thanks alot....i did mention i was new at this right :P
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now