Dave S Posted April 28, 2003 Posted April 28, 2003 :confused: Im having trouble again. Imagine a minefield grid. You have the tab index of the sender. how can I access the tag property of the adjoining buttons without clicking on them? I would like to use the tab index property of the button. I was thinking of scrolling through all 100 buttons untill the tabindex matched the index I am interested in, then read the tag, but I don't know how to increment the button names: btn1,btn2, etc. My brain hurts, Dave Quote
Guest mutant Posted April 28, 2003 Posted April 28, 2003 You could go through every button there and find the one with the matching index. Dim ctrl As Control For Each ctrl In Me.Controls If TypeOf ctrl Is Button Then if ctrl.TabIndex = numberyouwant then 'do something to that button end if End If Next Quote
Dave S Posted April 28, 2003 Author Posted April 28, 2003 Wow, that looks good! Thanks a LOT! Dave Quote
Guest mutant Posted April 28, 2003 Posted April 28, 2003 Or a simpler way of which i didn't think when writing my first post :D Before the code checked every control if its button. Now you it will only go through buttons. (So it should be better :) ) Dim btn As Button For Each btn In Me.Controls If btn.TabIndex = numberyouwant Then 'do something to the button End If Next Quote
Dave S Posted April 29, 2003 Author Posted April 29, 2003 Cool. I have all of my buttons inside a group, so I had to tweek it a bit. Thanks again Dave Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.