これは私のコードです:
protected void btnShow_Click(object sender, EventArgs e)
{
System.IO.StreamWriter stringWriter = new System.IO.StreamWriter(Server.MapPath(@"~/Puzzle/puzzle.txt"));
foreach (Control control in Panel1.Controls)
{
var textBox = control as TextBox;
if (textBox != null)
{
if (string.IsNullOrEmpty(textBox.Text))
{
textBox.Style["visibility"] = "hidden";
}
stringWriter.Write(textBox.Text+",");
} // end of if loop
}
stringWriter.Close();
}// end of button
たとえば、私のテキスト ファイルは次のようになります。
,S,U,P,,,,,,,,
テキストファイルで次のようにしたい:
,S,U,P,
,,,,
,,,,
4番目のコンマを打った後、次の行に移動したい。
どうすればいいのですか?