私は C# で最初のアプリケーションを開発しようとしていますが、単にファイルから読み書きしようとしています。私は何時間もの調査を行い、メンターに教えてもらいましたが、それは私には意味がありません.
フォームの先頭がレイアウトされており、使用している StreamWriter の正しい構文であると思われるものがありますが、ファイル名が別のプロセスで使用されているようで、どれかわかりません。ここに私が取り組んでいるコードがあります:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace CustomerApplication
{
public partial class AddCustomerForm : Form
{
public AddCustomerForm()
{
InitializeComponent();
}
private void saveAndExitBtn_Click(object sender, EventArgs e)
{
StreamWriter sw = File.AppendText("test.csv");
sw.WriteLine("Test for Hope");
// next, retrieve hidden form's memory address
Form myParentForm = CustomerAppStart.getParentForm();
// now that we have the address use it to display the parent Form
myParentForm.Show();
// Finally close this form
this.Close();
}// end saveAndExitBtn_Click method
これは、Visual Studio が気に入らない行です。
StreamWriter sw = File.AppendText("test.csv");
お時間をいただきありがとうございます。
~TT