Piszę, że plik jest używany przez inny proces, ale nie wiem gdzie go indziej używam(wydaję mi się, że nie). Można to jakoś naprawić?
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 Voc
{
public partial class FormKomunikat : Form
{
private void ZapiszUstawieniaKomunikatu(string ustawienie)
{
try
{
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\Komunikat.txt");
sw.WriteLine(ustawienie);
sw.Close();
}
catch (IOException ex)
{
MessageBox.Show("Błąd: " + ex, "Komunikat");
}
}
public FormKomunikat()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == false)
{
ZapiszUstawieniaKomunikatu("false");
}
else
{
ZapiszUstawieniaKomunikatu("true");
}
}
}
}