未将对象引用设置到对象实例?
运行后提示这个错误,看了半天都不知道哪边出了问题。求高手指点,感激不敬FileSystemInfo[] FSInfo;
string Fpath;
string path;
int i=0;
private void GetPic()
{
if(i<FSInfo.Length)
{
string FileType=FSInfo[i].ToString().Substring(FSInfo[i].ToString().LastIndexOf(".")+1);
FileType=FileType.ToLower();
if(FileType=="bmp"||FileType=="gif"||FileType=="jpeg"||FileType=="png")
pictureBox1.Image=Image.FromFile(Fpath+FSInfo[i].ToString());
}
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
if(folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
path=folderBrowserDialog1.SelectedPath;
DirectoryInfo dir=new DirectoryInfo(path);
FSInfo=dir.GetFileSystemInfos();
if(path.Length<=4)
Fpath=path;
else
Fpath=path+"\\";
}
}
private void timer1_Tick(object sender, System.EventArgs e)
{
GetPic();
if(i==FSInfo.Length-1)
i=0;
else
i++;
}