user interface - C# method failing to function for no known reason -


i'm taking programming class , learning c#. 1 of assignments have program run graphical user interface has text box input, text box output, , button copies whatever number in "input" text box , pastes output text box. reason method computebtn_click, method read number in input , put in output, doing absolutely nothing me, using method name computebtn_click_1 worked great. idea why?

here code(without using.system stuff):

 namespace windowsformsapplication1 {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void exittoolstripmenuitem_click(object sender, eventargs e)         {          }          //exittoolstripmenuitem1 method         //purpose: close window , terminate application.         //parameters: object generating event , event arguments.         //returns: none         void exittoolstripmenuitem1_click(object sender, eventargs e)         {             this.close();         }          //abouttoolstripmenu method         //purpose: give information application.         //parameters: object generating event , event arguments.         //returns: none         void abouttoolstripmenuitem_click(object sender, eventargs e)         {             messagebox.show("name\ncs1400\nlab #4");         }          private void intxtbox_textchanged(object sender, eventargs e)         {          }          private void outtxtbox_textchanged(object sender, eventargs e)         {          }          // reason method wasn't working.         // computebtn_click method         // purpose: value user , display again         // parameters: sending object, , event arguments         // returns: none         /*private void computebtn_click(object sender, eventargs e)         {             int num = int.parse(intxtbox.text);             string outstr = string.format("{0:d}", num);             outtxtbox.text = outstr;         }*/          // computebtn_click_1 method         // purpose: value user , display again         // parameters: sending object, , event arguments         // returns: none         private void computebtn_click_1(object sender, eventargs e)         {             int num = int.parse(intxtbox.text);             string outstr = string.format("{0:d}", num);             outtxtbox.text = outstr;         }     } }

when create event handlers visual studio assigns names automatically. in case have button named computebtn. in graphical designer create event handler click event. vs automatically creates name it: computebtn_click.

now if in graphical designer decide remove event handler (e.g. in properties tab button) nothing hooked click event method named computebtn_click remained in class. happen if decide create event handler click event? ide create new method , since there name computebtn_click modify name of new method still unique. in case results in computebtn_click_1.

to confirm that, can check references of method not work. show there no references in code method. check references click method's name , hit ctrl+k, r or use context menu.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -