की परिभाषा नहीं है, मैं here से मूल फ़ाइल संवाद उदाहरण का प्रयास कर रहा हूं, और मुझे 'ओके' पर एक त्रुटि मिलती है, और मुझे नहीं पता कि क्यों।'System.Nullable <bool>' में 'OK'
त्रुटि 1 'System.Nullable' 'ठीक है' और कोई विस्तार विधि 'ठीक है' प्रकार 'System.Nullable' का एक पहला तर्क को स्वीकार करने के लिए एक परिभाषा जानकारी नहीं होती है पाया जा सकता है (यदि आप एक निर्देश का उपयोग याद कर रहे हैं या एक विधानसभा संदर्भ?)
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