Results 1 to 4 of 4

Thread: OpenFileDialog.Filename string

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    4

    OpenFileDialog.Filename string

    Greetings everyone.

    I am trying writing a simple program that opens an image file in a pictureBox and displays its filename in a label below the picture.

    At the moment i am setting the filename label like this:

    picFileNameLabel.Text = OpenFileDialog.FileName

    This gives a result like "C:\blah\blah\mypics\file.jpg". I am more hoping to get just the filename i.e "file.jpg"

    Does anyone know of an easy way to do this?

    Cheers

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    This way
    VB Code:
    1. dim fileonly as String =io.Path.GetFileName(absolutePath)

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. picFileNameLabel.Text = IO.Path.GetFileName(OpenFileDialog.FileName)

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    4
    Thanks guys, thats great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width