IN THE NAME OF GOD
HELLO TO ALL
i wanna build a program that when it run, in one form equal rows in a DB , build button and with every button clicked, run program that addressed in programaddress column.
i build buttons and assign to a array of button.
i cant know which button is clicked.
can anyone help me?
THANKFUL.
GOODBYE.

Recommended Answers

All 3 Replies

the sender object keeps track of what object invoked the event. So just cast the sender to a button object.

Button B = (Button)sender;

then get what ever information from the button that you need.
example

B.Text//returns text on button
B.Name//returns name of button

You can also use the Tag property of the button when you build your button array and supply it any data you want. Use a scheme like Diamonddrake proposed, to retieve the data : B.Tag

IN THE NAME OF GOD
HELLO TO ALL
Thankful all.
that problem solved.
thankful.
THANKFUL.
GOODBYE.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.