我的代码有问题。我在我的项目中使用 OpenFileDialog,当我调用 ShowDialog 方法时会引发异常。我不明白为什么。
private void open_FileMenu(object sender, RoutedEventArgs e)
{
OpenFileDialog browser = new OpenFileDialog();
browser.AddExtension = true;
browser.Filter = "Audio, Video File | *.wma; *.mp3; *.wmv";
browser.Title = "Choose your file";
if (browser.ShowDialog() == System.Windows.Forms.DialogResult.Yes) // Exception thrown here
{
try
{
string FileName = browser.FileName;
MyMedia.Source = new Uri(FileName);
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
}
这个例外说
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dl
附加信息:参数不正确
有人可以帮助我吗?