none
What is this strange exception? RRS feed

  • Question

  • Everything works with this code:

          
    Everything works with this code:
    
           private void BrowseButton1(object sender, RoutedEventArgs e)
            {
                OpenFileDialog fd = new OpenFileDialog();
                fd.InitialDirectory = "\\\\Nx3200\\supplier\\FONEX\\LambdaGain";
                fd.Filter = "Binary Files  | *.bin";
                fd.ShowDialog();
                filePath1.Text = fd.FileName;
            }
    
    


    However, when I try to do Multi Select (because I want to select multiple files) like so:

             private void BrowseButton1(object sender, RoutedEventArgs e)
            {
                OpenFileDialog fd = new OpenFileDialog();
                fd.Multiselect = true;
                fd.InitialDirectory = "\\\\Nx3200\\supplier\\FONEX\\LambdaGain";
                fd.Filter = "Binary Files  | *.bin";
                fd.ShowDialog();
                filePath1.Text = fd.FileName;
            }


    The code shoes the error: **System.Runtime.InteropServices.COMException: 'Creating an instance of the COM component with CLSID {DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7} from the IClassFactory failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111** 

    This error is shown in the fd.showDialog()

    Please help

      
    Friday, January 17, 2020 9:10 PM

All replies

  • Hi KingRaptor91, 
    I test your code and it is run successfully. So I find some related documents and hope these can help you.
    About the error, you can refer to Lex Li's solutions.
    And here is a similar issue you can refer to.
    [Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)]
    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 20, 2020 9:19 AM
  • Change your InitialDirectory temporarily to a local file system path (e.g C:\temp). Does it work? If so then the issue is with the network driver that is supporting Nx3200. That looks like a third party hardware device (perhaps a PLC) to me. Therefore you installed a driver in Windows to talk to it directly. That driver probably does not implement the necessary APIs to allow multi-select to work properly. 

    However there could be other causes and you just haven't seen it yet. For example this code needs to be called from a UI thread. Going on the theory you are calling this code in response to some event outside the UI, the call needs to run on the UI thread otherwise you get errors like this. Check the result of `InvokeRequire`. If it is false then you are not on the UI thread and no UI calls will work properly. 


    Michael Taylor http://www.michaeltaylorp3.net

    Monday, January 20, 2020 4:49 PM
    Moderator