{"id":4877,"date":"2014-03-30T16:22:19","date_gmt":"2014-03-30T16:22:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/get-text-inside-buttons-when-pressed-using-only-one-event-handler-closed-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:22:19","modified_gmt":"2014-03-30T16:22:19","slug":"get-text-inside-buttons-when-pressed-using-only-one-event-handler-closed-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/get-text-inside-buttons-when-pressed-using-only-one-event-handler-closed-collection-of-common-programming-errors\/","title":{"rendered":"Get text inside buttons when pressed using only one event handler [closed]-Collection of common programming errors"},"content":{"rendered":"<p>You can efficiently add handle your <code>button's click event<\/code> during runtime like this,<\/p>\n<p>I assume that you are having your <code>buttons<\/code> inside a <code>panel<\/code> called <code>PnlBtns<\/code>.<\/p>\n<pre><code>'Traversing through panel and adding a common handler for buttons\nFor each ctrl in PnlBtns.controls\n If TypeOf ctrl is button then\n   AddHandler ctrl.Click, AddressOf CommonClickHandler\n end if\nNext\n\n'Common Handler for all of your buttons.\nPrivate Sub CommonClickHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)\n  MsgBox(ctype(sender,button).text)\nEnd Sub\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can efficiently add handle your button&#8217;s click event during runtime like this, I assume that you are having your buttons inside a panel called PnlBtns. &#8216;Traversing through panel and adding a common handler for buttons For each ctrl in PnlBtns.controls If TypeOf ctrl is button then AddHandler ctrl.Click, AddressOf CommonClickHandler end if Next &#8216;Common [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4877","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4877"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4877\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}