代码:
namespace bla_bla_bla
{ public delegate void pathSelected(string path);
//...
public partial class Form1 : Form
{
public pathSelected onPath;
//...
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter ="Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF";
openFileDialog1.Multiselect = true;
openFileDialog1.ShowDialog();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
if (openFileDialog1.SafeFileName != null)
onPath(openFileDialog1.SafeFileName);
}
问题:
为什么我null
在最后一行得到参考例外?
错误:
(原始海报应在此处添加)