繁体   English   中英

我的vb.net应用程序在使用Windows 10 OS的openfileDialog上崩溃

[英]My vb.net application crashes on openfileDialog using windows 10 OS

我的vb.net应用程序openfileDialogwindows 7上可以正常工作,但在Windows 10上却无法正常运行。我已经在windows 10 OS上启用了3.5框架,但还是没有运气。 这是我的代码:

 Dim OpenFileDialog1 As New OpenFileDialog
        Try
            OpenFileDialog1.Filter = "Picture Files (*)|*.bmp;*.gif;*.jpg;*.png"
            If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                OpenFileDialog1.ShowHelp = True
                pbAttachments.Image = Image.FromFile(OpenFileDialog1.FileName)

            Path_And_File_Name = OpenFileDialog1.FileName
            ImgFileSize = My.Computer.FileSystem.GetFileInfo(Path_And_File_Name).Length

            DoubleBytes = CDbl(ImgFileSize / 1048576) 'MB
            ImgFileSize_MB = FormatNumber(DoubleBytes, 2)

            If ImgFileSize_MB > 3 Then
                MsgBox("Image attachment is limited to 3 MB, the image file size you are trying to upload is " & ImgFileSize_MB & " MB!" & vbCrLf & "Please rezize your Image!", vbExclamation)
                Exit Sub
            End If
        End If
    Catch ex As Exception
        MsgBox(ex.Message)
    Finally
        ReleaseMemory()
        OpenFileDialog1.Dispose()
    End Try

请帮忙,谢谢!

我通过重新安装Windows 10操作系统然后重新启用框架3.5解决了此问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM