Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:13:09+00:00 2026-06-08T05:13:09+00:00

On Visual Studio C# Express when I run the script below, I get the

  • 0

On Visual Studio C# Express when I run the script below, I get the following error message on the line saying:

if (ofd.ShowDialog() == true):
Error 1 Operator ‘==’ cannot be applied to operands of type ‘System.Windows.Forms.DialogResult’ and ‘bool’

How could I solve this? Code below:

public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
{
    System.Windows.Forms.OpenFileDialog ofd = new  System.Windows.Forms.OpenFileDialog();
    ofd.Multiselect = true;

    ofd.Filter = "Data Sources (*.ini)|*.ini*|All Files|*.*";
    if (ofd.ShowDialog() == true)
    {
        string[] filePath = ofd.FileNames;
        string[] safeFilePath = ofd.SafeFileNames;
    }
    return base.RespondToMouseDoubleClick(sender, e);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:13:12+00:00Added an answer on June 8, 2026 at 5:13 am

    I suspect you’ve been reading the WPF OpenFileDialog.ShowDialog documentation where the method result is Nullable<bool>. If, however, you’re using Windows Forms OpenFileDialog.ShowDialog, that returns DialogResult – which you clearly can’t compare with bool.

    Have a look at DialogResult and see what you actually want to do. Note that the documentation claims:

    Return: DialogResult.OK if the user clicks OK in the dialog box; otherwise, DialogResult.Cancel.

    … so those should be the only cases you need to consider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I run windows vista business and want to try MS Visual Studio Express 2012.
Will IIS express run PHP in visual studio? If so, will you be able
I am using Visual Studio Express 2012 RC. If a create a blank hello
I am currently using Visual Studio Express C++ 2008, and have some questions about
Are any of the Visual Studio Express editions able to work with C++/CLI code?
As you all know Visual Studio Express edition do not support Source Control Integration
I've just started up visual studio express 2008 for the first time in 6
Can I develop Silverlight applications in Visual Studio express? When I start up Visual
How do I debug IE7 javascript with Visual Studio Express and which version should
I have built up the wcf web service in visual studio express 2010. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.