Event Handling with an array of TextBoxes

Posted on 2003-03-25
Medium Priority
Last Modified: 2010-04-15

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...
Question by:saneman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Accepted Solution

AlexFM earned 300 total points
ID: 8208504
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


Author Comment

ID: 8215030
thanks alot....i did mention i was new at this right :P

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question