openfiledialog를 사용하여 calender.txt 파일을 엽니 다.이 파일을 열면 calender를 파일 이름으로 표시하고 .txt는 필터 상자의 c : \OpenFileDialog에서 전체 경로와 파일 이름을 표시하는 방법
없이 표시합니다.사람은 내가 어떻게 C를 얻을 수 있도록 대화를 코딩하는 나에게 보여 주시겠습니까 : 대화
private void openFileButton_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = (@"C:\");
ofd.Filter = ("*.txt| Text File");
ofd.FileName = "calender.txt";
ofd.CheckFileExists = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (CheckValidity(ofd.FileName))
{
try
{
streamWriter sw = new streamWriter(ofd.FileName);
}
catch (FileLoadException flEx)
{
MessageBox.Show(flEx.Message);
}
else
{
}
}
}
}
당신은'ofd.FileName = Path.Combine (ofd.InitialDirectory, "calendar.txt");'을 시도 했습니까? – TyCobb
나는 당신이 제어반에있는 폴더 선택권의 밑에 그것을 놓아야 한 ㄴ다고 믿는다 – Steve
감사하십시오 TyCobb는 그것을 – Tom