'System.Windows.Forms.FolderBrowserDialog' is a type not a namespace

后端 未结 6 419
眼角桃花
眼角桃花 2020-12-22 02:29

It is possible that I\'m missing something very obvious but now I can not see now. I have the reference to System.Windows.Forms and I have the next using<

6条回答
  •  感情败类
    2020-12-22 03:25

    You cannot do

    using System.Windows.Forms.FolderBrowserDialog;
    

    as it is a type and not a namespace. The namespace it belongs to is System.Windows.Forms. Remove this line and if you want to instantiate a FolderBrowserDialog and just make sure you have the line

    using System.Windows.Forms;
    

    and make a FolderBrowserDialog like so:

    var fbd = new FolderBrowserDialog();
    

    All this is in contrast to Java, where you import types not use namespaces, which is where you may be going wrong - in Java you would do something like:

    import System.Windows.Forms.FolderBrowserDialog;
    

    and then be able to use it.

提交回复
热议问题