Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trying to get a pic to appear

  1. Mar 4, 2012 #1
    Public Class Form1

    Private Sub btnDisplayPic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayPic.Click

    OpenFileDialog1.Filter = "Image Files (*.jpg)|*jpg"

    OpenFileDialog1.ShowDialog()

    Try
    txtPicFile.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
    Catch myfilenotfound As System.IO.FileNotFoundException
    MessageBox.Show("File not found - select a different file!")

    Catch ex As Exception
    MessageBox.Show("Unexpected error!")

    End Try


    End Sub
    End Class


    here is my code.......
     
  2. jcsd
  3. Mar 4, 2012 #2

    DavidSnider

    User Avatar
    Gold Member

    Public Class Form1

    Private Sub btnDisplayPic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayPic.Click

    OpenFileDialog1.Filter = "Image Files (*.jpg)|*jpg"

    if dlg.ShowDialog() = DialogResult.OK
    imgPhoto.Image = new Bitmap(dlg.OpenFile());
    end if

    End Sub
    End Class
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Trying to get a pic to appear
  1. Programming a PIC (Replies: 21)

  2. PIC IO in assembly (Replies: 3)

Loading...