473,387 Members | 1,516 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,387 software developers and data experts.

work with buttons

18
please how i can handle button corresponding to integer variable like i
ie: when i=1 i want to enable button1 and when i=2 i want t enable button 2 and so on
Feb 13 '09 #1
6 1189
Shashi Sadasivan
1,435 Expert 1GB
One way of handling that is to make i a private variable and have only one method to change it. whenever the method is called, attach an event handler to this method. you may pass variables across on what the state of the button should be or let the UI handle that.
Feb 13 '09 #2
deeas
18
i think my question wasn't clear enough
i want to write thing like:
for i=0 i<10 i++
button(i).text= number(i)
is it possible
thanks
Feb 13 '09 #3
Shashi Sadasivan
1,435 Expert 1GB
the idea is still the same,
you want to change the propert of the button (text is a property)

if you run the code above, the application will freeze (try it for a large number so that the for loop takes time) and the text on the button will show up as the last change made to it.

You will need to run the for loop in a seperate thread, and if you create an even when ii changes, use that to trigger the property of the UI
Feb 13 '09 #4
deeas
18
thanks i will try this
Feb 14 '09 #5
vekipeki
229 Expert 100+
You could do it by adding references to all you buttons to an array.

1. Add a private field which will hold references:
Expand|Select|Wrap|Line Numbers
  1. // add a private field
  2. private readonly Button[] buttons;
2. Then fill the array inside your constructor:
Expand|Select|Wrap|Line Numbers
  1. // then add this after InitializeComponent()
  2. buttons = new Button[] {
  3.        button1,
  4.        button2,
  5.        ...
  6.        (add all buttons here)
  7.    };
Feb 16 '09 #6
deeas
18
this is what i need,thank you
Feb 16 '09 #7

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

Similar topics

0
by: Martin | last post by:
Hi All, I am a relative newbie to Java / Applets, but am despirately after some help ! I have got the following code, which is basically a listing with button items along the sides, allowing...
3
by: Mr. B | last post by:
With Deft Fingers, "Jan Driesen" <jan.driesen@tiscali.be> wrote: I've an app with a bunch of Control Array of Buttons. I'll use code from my App using 5 buttons as my example: 1) I've Dim...
3
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the...
2
by: Alan Silver | last post by:
Hello, I have just discovered that if you turn off Javascript, then cross-page posting does not work. The postback goes to the originating page, which basically means that nothing happens. I...
2
by: Jim Carr | last post by:
Upon entering the site www.FutureByDesign-Music.com with IE6, my clipboard is erased and then disabled in all other Windows XP applications. Navigating to another site returns clipboard...
4
by: Neil | last post by:
I just noticed that control tips aren't working in any of my databases. I recently installed Access 2003, and created a database in it, and noticed that control tips weren't working in my controls....
10
by: mint89 | last post by:
This is probably a rather easy fix, but I know next to nothing about java. I am attempting to create a page that has two rows of buttons, and I wanted to have some sort of mouseover effect on them. ...
0
by: Shataken | last post by:
I have developed an app on a computer that is set to windows classic as it's theme (XP pro machine). When I publish the app it works fine on machines with the theme set to windows classic, but if...
1
by: jharris | last post by:
I am having problems with several buttons on my web page. Im using Flash MX 2004 and Dreamweaver. When I test the movie, at first I have to click the buttons two or three times to go to the web...
1
by: fidokomik | last post by:
I'm trying to add new tags into document using createElement() function but this not work. Tested in FF2 and IE6. Simple example is here http://web.practisoft.cz/samples/jstest.html Buttons...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.