Using Visual Basic to Make Average Test Score Generator in C# -


i'm trying create calculator assignment takes 3 integer inputs , takes average , returns user. i'm using visual basic (it required) make gui. i'm having trouble 2 things, first, cannot aver divide 3 because not integer , second, not know how output average in last textbox.

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace windowsformsapplication1 { public partial class form1 : form {     private string userinfo1;     private string userinfo2;     private string userinfo3;     private string aver;     private string num1;     public form1()     {         initializecomponent();     }      private void button1_click(object sender, eventargs e)     {         int aver = 0;         aver = int32.parse(userinfo1 + userinfo2 + userinfo3);      }      private void textbox1_textchanged(object sender, eventargs e)     {         int userinfo1 = 0;         userinfo1 = int32.parse(textbox1.text);     }      private void button2_click(object sender, eventargs e)     {         close();     }      private void textbox2_textchanged(object sender, eventargs e)     {         int userinfo2 = 0;         userinfo2 = int32.parse(textbox2.text);     }      private void textbox3_textchanged(object sender, eventargs e)     {         int userinfo3 = 0;         userinfo3 = int32.parse(textbox3.text);     }      private void textbox4_textchanged(object sender, eventargs e)     {         int num = int32.parse(aver);         messagebox.show(num.tostring());     }         private void label3_click(object sender, eventargs e)     {       }     }    } 

you declaring variables multiple times. variables inside function calls hide variables have defined outside in class declaration, , class variables never set value.

it doesn't appear ever using of variables in string form, private string declarations should changed private int declarations. makes int userinfo1 = 0; declarations unnecessary. having them breaks ability see values in button1_click function.


Popular posts from this blog