I have a problem with my code. I use OpenFileDialog in my project and when I call the method ShowDialog an exception is thrown. I don't understand why.
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);
}
}
This exception said
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dl
Additional information: Incorrect parameter
Someone can help me ?