string s = "abc 0";
if ( this.comboBox1.Text == "是")
{
s = "abc 1";
}

System.IO.StreamWriter sw = new System.IO.StreamWriter("c:\\1.txt");
sw.Write(s);
sw.Close();

解决方案 »

  1.   

    System.IO.FileStream myfile=new System.IO.FileStream(System.IO.Directory.GetCurrentDirectory() + "\txt.txt", System.IO.FileMode.Append);
            System.IO.StreamWriter myWriter =new System.IO.StreamWriter(myfile);
            if(this.ComboBox.Text=="是")
               myWriter.WriteLine("abc 1");
            else
               myWriter.WriteLine("abc 0");
            myWriter.Flush();
            myWriter.Close();
            myfile.close();