here의 기본 파일 대화 상자 예제를 사용하고 있는데 '확인'오류가 발생하고 이유를 모르겠습니다.'System.Nullable <bool>'에 'OK'에 대한 정의가 없습니다.
오류 'System.Nullable'에 'OK'에 대한 정의가없고 'System.Nullable'유형의 첫 번째 인수를 허용하는 확장 메서드가 없습니다 (using 지시문이 누락 되었습니까? 당신이
DialogResult
라는 지역의 특성을 가지고있는 것처럼 또는 어셈블리 참조가?)
private void button1_Click(object sender, System.EventArgs e)
{
Stream myStream = null;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
if ((myStream = openFileDialog1.OpenFile()) != null)
{
using (myStream)
{
// Insert code to read the stream here.
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}
당신의 OpenFileDialog를이 무엇 조립입니다? –
이 작품은 좀 더 구체적인 수 있습니까? 오류는 아마도 여기에 없습니다 ... – jeroenh