私が達成したいのは、テキストファイルをロードしてから、次のすべての行をカウントすることです:
- 文字「X」で始まる
- 文字「Y」で終わる
私のコードは次のようになります。
string txtContent;
try
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
txtContent = File.ReadAllText(openFileDialog1.FileName);
}
}
catch (Exception ex) {
MessageBox.Show(ex.Message, "Form1", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
txt ファイルの内容をtxtContent
文字列変数に読み込んでいます。しかし、私は続行する方法がわかりませんか?