I have the following code to search for an image on my PC from a Visual Basic form and then save it in a Database, but I only get one error when opening the dialog box that searches for the image. The code is the following:
Private Sub AbrirImagen()
Dim filename As String
Dim openfiler As New OpenFileDialog
With openfiler
.InitialDirectory = "C:\"
.Filter = "Archivos de imágen(*.jpg)|*.jpg|All Files (*.*)|*.*"
.FilterIndex = 1
.RestoreDirectory = True
End With
If openfiler.ShowDialog = Windows.Forms.DialogResult.OK Then
filename = openfiler.FileName
Me.PictureBox1.Image = Image.FromFile(filename)
End If
End Sub
In the part that says Windows.Forms
I get the following error:
'Forms' is not a member of 'Windows'
Could you help me? I work in Visual Studio 2015
If you check the documentation
Form.DialogResult (Property)
you will see that you should define the
at the beginning of the form, then in the code it would be