How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
Go Back  Xtreme Visual Basic Talk > > > How do I get the index of a control in a control array when that control is clicked?


Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2006, 09:16 AM
TexasAggie TexasAggie is offline
Junior Contributor
 
Join Date: Feb 2004
Location: San Antonio, TX
Posts: 286
Default How do I get the index of a control in a control array when that control is clicked?


I have two control arrays (label and led). I need to get the index of the led when I click on one so I know what action to perform. How is this possible?

This is my event handler:

Code:
Public Sub TCLedClickEvent(ByVal sender As Object, ByVal e As EventArgs) Dim TCLed As Led = DirectCast(sender, Led) TCLed.Value = True End Sub

Thanks.
Reply With Quote
  #2  
Old 06-16-2006, 12:56 PM
wayneph's Avatar
waynephHow do I get the index of a control in a control array when that control is clicked? wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

You should be able to use the IndexOf method from either the Array or ArrayLIst to detemine the position.

myIndex = MyCtrlArray.IndexOf(sender)
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 06-16-2006, 02:31 PM
TexasAggie TexasAggie is offline
Junior Contributor
 
Join Date: Feb 2004
Location: San Antonio, TX
Posts: 286
Default

This does not work:

Code:
BrokenTC(TCLeds.IndexOf(sender) + FirstBedTemp) = True

It doesn't like your indexof procedure although it picks it up using Intellisense.
Reply With Quote
  #4  
Old 06-19-2006, 11:32 AM
TexasAggie TexasAggie is offline
Junior Contributor
 
Join Date: Feb 2004
Location: San Antonio, TX
Posts: 286
Default

ahhh Array.IndexOf(TCLeds, sender) should work...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked? How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
 
How do I get the index of a control in a control array when that control is clicked?
How do I get the index of a control in a control array when that control is clicked?
 
-->