Henry Bartosch

Henry Bartosch

  • NA
  • 44
  • 13.5k

Saving to a txt file

Apr 3 2011 6:07 AM
I need help really fast please. only have 4 hours left to do this.

private void button1_Click(object sender, EventArgs e)
{
string[] str = textBox1.Text.Split(',');
int result = 0, first = 0,second = 0,third = 0;


for (int i = 0; i < str.Length; i++)
{

if (i==0)
{
first = Convert.ToInt32(str[0]);
}
else if (i == str.Length -3)
{
second = Convert.ToInt32(str[str.Length - 3]);
}
else if (i == str.Length -1)
{
third = Convert.ToInt32(str[str.Length -1]);
result = first + second + third;
}
}

i want the answer of this to save to a text file when pressing the save button

Answers (1)