【发布时间】:2018-05-16 06:25:00
【问题描述】:
我的 vb.net 应用程序 openfileDialog 在 windows 7 上运行良好,但在 Windows 10 上崩溃。我已经在 windows 10 操作系统上启用了 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
请帮忙,谢谢!
【问题讨论】:
-
1) 这是一个 WinForms 应用程序吗? 2)
ReleaseMemory是做什么的? 3)检查this question。 -
ReleaseMemory() 函数只是为了减少应用程序的内存消耗。我已经尝试删除它,但它并不能解决问题先生。 :(
-
是的,这是一个 Winform 应用程序。
-
Accounting System.exe 中 0x614bed6f 处未处理的异常:0xC000041D:在用户回调期间遇到未处理的异常。