0

i have a btn_menu where it will add dynamically a group of buttons depending on the menu name (once adding the button the buttontext(menuName) is automatically addded).. and those added button (programmatically) have an event "addhandler" where I input the series of codes to retrieve data from the database (ms access) using the button.text. what my problem is i dont know how i can get the button.text.

the button.text that always shows is the last button that was added dynamically.

aconn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\MENU.accdb;"
    aconn.Open()
    fil = ("select * from MENU_Items where MenuName='" & button.Text & "'")
Harsha W
  • 3,162
  • 5
  • 43
  • 77
Sheine
  • 1
  • 1
  • Why dynamically add buttons? Why not just control visibility? Which button do you want to get text from? Reference button by its name. – June7 Mar 31 '17 at 07:40
  • For example: i add menu(fries) , then i want it to be accessible as a button. So whenever i add menu it should add button. It will become a button array(with arrah codes) but i want to retrieve data with their specific menu name.. Which supposedly written as the button text. Do you think its possible? – Sheine Apr 01 '17 at 06:14
  • Does this help http://stackoverflow.com/questions/15336379/get-text-inside-buttons-when-pressed-using-only-one-event-handler – June7 Apr 01 '17 at 06:59

0 Answers0