473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to know the location of a button in a button array

2
Hi

i have a button array of [8,8]. know i want that when i press a button, i get the location of the button in the array, not which button is pressed but the location.I used the sender to do a tempbutton and therefore change the text of that particular button but i want its location....

(the array is buttarr[8,8])

ex: buttarr[1,2] was pressed

can someone help

Thanks
Mar 3 '10 #1
1 1632
GaryTexmo
1,501 Expert 1GB
There's a few things you can do... first, the hard way!

When you click the button, search the array for it. The event handler for the button has a parameter called sender, this is the object that triggered the event. Cast it as a button and then look for it in the array. When you find it, you'll have the index location of the button.

Now for the easy way. When you build the button grid, do one of two things. Name the button (Button.Name) something appropriate to it's grid location. You could also put that into the tag (Button.Tag). That way, your sender would already know where it was in the grid, you wouldn't need to search for it.
Mar 4 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
2
by: Brvsra | last post by:
Javascript Experts, I know very little about javascript and could use someone's help. I have created a function to send an email, listed below is the function. The function works fine, with...
72
by: ravi | last post by:
I have a situation where i want to free the memory pointed by a pointer, only if it is not freed already. Is there a way to know whether the memory is freed or not?
7
by: sunil philip | last post by:
How do i identify the page that fired a method? e.g. page1.html ----------- <Head> <script> document.write(myfun()); </script>
1
by: Colin McGuire | last post by:
Thanks everyone for help in my previous post. Using the "Point.op_Addition" from the previous post I have to now focus on the real problem. I need to manually position a new form so that its...
1
by: wannieb | last post by:
I am hoping someone can help me in this little problem, I have a php page with dynamic menu boxes on it. SCRIPT ********* <!-- Below are arrays for the two dropdown menus and creates selected...
13
by: johnemmatty | last post by:
I am using an asp page in which i dynamically fill the ACTION property of the form. The problem is that whenever i try to redirect to a html page using the javascript:location, it is getting...
4
by: munibe | last post by:
Hi, i have a problem about picturebox control. if you may help me, i will be so happy. i have a picturebox named pic_map, and i added a button named customer_button, my wish is to add a new small...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I placed a button on a form menustrip for the purpose of causing the horizontal scrollbar of my form to appear so that I can access controls outside of the form's current view (the controls are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.