CodePudding user response:
in the excel spreadsheet, computing is, the bossCodePudding user response:
Just use Excel, function is very powerful,CodePudding user response:
Var text="111 \ r \ n222 \ r \ n333 \ r \ n";
Var arr=text. The Split (" \ r \ n ". ToCharArray ());
var sum=0;
The foreach (var item in arr)
{
The sum +=item. ToInt ();
}
Probably is this meaning, the details, to run if you have any question to adjust again
CodePudding user response:
To convert a string to integer and add it,CodePudding user response:
I want to directly in the window displayCodePudding user response:
Can be calculated in the formCodePudding user response:
to use EXCEL to go ~ unless you want to be lazy, the design of a process is necessary, you can line in TXT read, turn the type, added together, it is not necessary to import the textboxCodePudding user response:
Premise is no interval of empty linesPrivate void button1_Click (object sender, EventArgs e)
{
if (! String. IsNullOrEmpty (textBox1. Text))
{
Var text=textBox1. Text. Replace (" \ r \ n ", "+");
If (text [text Length - 1]=='+') text +="0";
TextBox1. AppendText (" \ r \ n total: "+ new DataTable (.) Compute (text, null). The ToString ());
}
}