c# - Summing numbers in many TextBox and writing them to a file -


this program inserting expenses making in textboxes have insert numbers. have save numbers textboxes txt file, summed. can me ideas?

private void button2_click_1(object sender, eventargs e) {     try     {         stringbuilder sb = new stringbuilder();         sb.appendline(textbox1.text + " " + textbox2.text + " " + textbox3.text + " " + textbox4.text);         file.writealltext(filename, sb.tostring());     }     catch (exception ex)     {         messagebox.show(ex.message, "error!", messageboxbuttons.ok, messageboxicon.error);     } } 

you need line adds numbers this:

private void button2_click_1(object sender, eventargs e)  {  try  {  stringbuilder sb = new stringbuilder();  sb.appendline(textbox1.text + " " + textbox2.text+ " " + textbox3.text+ " " + textbox4.text);  sb.appendline((int32.parse(textbox1.text) + int32.parse(textbox2.text) + int32.parse(textbox3.text) + int32.parse(textbox3.text)).tostring())              file.writealltext(filename, sb.tostring());          }         catch(exception ex)         {             messagebox.show(ex.message, "error!", messageboxbuttons.ok, messageboxicon.error);         }     } 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -