2013-11-27 2 views

답변

6

버튼을 생성하고 클릭 이벤트를 처리하기 위해 수행해야하는 작업 (저장 버튼 또는 파일 열기 버튼 클릭)을 수행하지 않으면이 대화 상자가 표시되지 않습니다.

this.button1.Click += new System.EventHandler(this.button1_Click); 

하고이 경우에, 당신은 당신의 대화

private void button1_Click(object sender, EventArgs e) 
{ 
    if (openFileDialog1.ShowDialog() == DialogResult.OK) 
    { 
     string filename = openFileDialog1.FileName; // this is the selected file 
    } 
} 
를 호출 할 수 있습니다