Jump to content

Recommended Posts

Posted

eu queria buscar o caminho de uma imagem para depois utilizar o caminho

mas ao executar o programa quando carrego no butao que contem o codigo dame erro

este e o meu coodigo

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.Title = "Selecione a imagem"
        OpenFileDialog1.InitialDirectory = "C:\imagens"
        OpenFileDialog1.ShowDialog()     'o erro é aqui'
    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk

        Dim strm As System.IO.Stream
        strm = OpenFileDialog1.OpenFile()
        TextBox1.Text = OpenFileDialog1.FileName.ToString()

    End Sub

Desde ja muito obrigado

Posted

Hmm, só para despiste, experimenta da seguinte forma:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim OFD As New OpenFileDialog
    OFD.ShowDialog()
End Sub

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.