none
openfiledialog "Parameter is not valid" after update to windows 10 pro 1809 RRS feed

  • Question

  • My system was just updated to Windows 10 Pro 1809 yesterday.  I have multiple vb.net projects with an openfiledalog.showdialog calls.  

    It now produces a "Parameter is not valid" error when executed.  it gives no indication of which parameter(s) is/are not valid.


    The same error is shown whether the parameters are explicitly set or as default.

    using defaults code:

            Dim ofd As New OpenFileDialog
            If ofd.ShowDialog = DialogResult.OK Then
                Dim x1 As Int16 = 1
            Else
                Dim x2 As Int16 = 2
            End If

    Explicit parameter setting code ( defines OpenFileDialog in the designer. )

            OpenFileDialog.Title = "Open ANSI 837"
            OpenFileDialog.InitialDirectory = CurDir()
            OpenFileDialog.DefaultExt = "hip"
            OpenFileDialog.FileName = ""
            OpenFileDialog.Filter = "All files (*.*)|*.*|ANSI837 files (*.hip)|*.hip"
            OpenFileDialog.FilterIndex = 2
            OpenFileDialog.RestoreDirectory = True
            If OpenFileDialog.ShowDialog() = DialogResult.OK Then

                Dim x1 As Int16 = 1
            Else
                Dim x2 As Int16 = 2
            End If

    What is causing this error and is there a known soution?

    This is severe problem.  We have a large number of programs dependent on the OpenFileDialog control.

    Jim


    Monday, April 1, 2019 1:56 AM

Answers

  • This problem was resolved by changing the inheritance for the form class.

    FROM

       Inherits C1.Win.C1Ribbon.C1RibbonForm

    TO

        Inherits System.Windows.Forms.Form

    Our application uses the ComponentOne libraries.  Apparently there is an issue with compatibility with the 1809 version of Windows 10 Pro

    Jim

    • Marked as answer by btbjim Monday, April 1, 2019 6:31 PM
    Monday, April 1, 2019 6:31 PM

All replies

  • Hi,

    My system is also Windows 10 Pro 1809, test your code, it works fine.

    Best Regards,

    Alex


    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, April 1, 2019 8:39 AM
  • Hi

    Windows 10 Pro 1809

    Seems all OK here using your code.

        Dim ofd As New OpenFileDialog
        ofd.Title = "Open ANSI 837"
        ofd.InitialDirectory = CurDir()
        ofd.DefaultExt = "hip"
        ofd.FileName = ""
        ofd.Filter = "All files (*.*)|*.*|ANSI837 files (*.hip)|*.hip"
        ofd.FilterIndex = 2
        ofd.RestoreDirectory = True
        Dim x1 As Int16
        If ofd.ShowDialog = DialogResult.OK Then
          x1 = 1
        Else
          x1 = 2
        End If


    Regards Les, Livingston, Scotland

    Monday, April 1, 2019 8:51 AM
  • Hello,

    Try doing the following, comment out all property setters, try using the dialog, does the problem happen? If not uncomment one e.g.  Title, try and keep trying until something breaks.

    Also, where is the current directory? Instead of using CurrDir use Directory.GetCurrentDirectory(), what is the path?

    Bottom line is OpenFileDialog is only raising an exception from the operating system. It could possibly be an Encoding issue. If you do a search on this issues there are plenty and none point back to the OpenFileDialog as the problem.

    Dim ofd As New OpenFileDialog
    'ofd.Title = "Open ANSI 837"
    'ofd.InitialDirectory = CurDir()
    'ofd.DefaultExt = "hip"
    'ofd.FileName = ""
    'ofd.Filter = "All files (*.*)|*.*|ANSI837 files (*.hip)|*.hip"
    'ofd.FilterIndex = 2
    'ofd.RestoreDirectory = True
    If ofd.ShowDialog() = DialogResult.OK Then
    
        Dim x1 As Int16 = 1
    Else
        Dim x2 As Int16 = 2
    End If


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, April 1, 2019 9:39 AM
    Moderator
  • This problem was resolved by changing the inheritance for the form class.

    FROM

       Inherits C1.Win.C1Ribbon.C1RibbonForm

    TO

        Inherits System.Windows.Forms.Form

    Our application uses the ComponentOne libraries.  Apparently there is an issue with compatibility with the 1809 version of Windows 10 Pro

    Jim

    • Marked as answer by btbjim Monday, April 1, 2019 6:31 PM
    Monday, April 1, 2019 6:31 PM
  • This problem was resolved by changing the inheritance for the form class.

    FROM

       Inherits C1.Win.C1Ribbon.C1RibbonForm

    TO

        Inherits System.Windows.Forms.Form

    Our application uses the ComponentOne libraries.  Apparently there is an issue with compatibility with the 1809 version of Windows 10 Pro

    Jim

    And that is something we could never guess as 99.9999 percent of developers are not using inheritance. Happy you are working okay now :-) 

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, April 1, 2019 6:38 PM
    Moderator