Thursday, August 13, 2020

[VB][Resolved] name "OpenFileDialog" is not declared

 * Visual Studio 2008 with .Net framework version 3.5


Error code:

Dim result As DialogResult = OpenFileDialog.ShowDialog()

If result = DialogResult.OK Then

  'Do sth

End If


Firstly let imports System.Windows:

Imports System.Windows

and then try another syntax

Dim odf As FileDialog = New OpenFileDialog()

If odf.ShowDialog = DialogResult.OK Then

  'Do sth

End If


Reference:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.openfiledialog?view=netcore-3.1

No comments :

Post a Comment