Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. OpenFileDialog: Return just file name

OpenFileDialog: Return just file name

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brad Fackrell
    wrote on last edited by
    #1

    Does anybody know of a way to return just the file name (without the full path) using the OpenFileDialog? Example: OpenFileDialog.FileName returns ‘c:\dir1\textfile.txt’ But I want OpenFIleDialog.?? To return ‘textfile.txt’ Thanks Brad

    D 1 Reply Last reply
    0
    • B Brad Fackrell

      Does anybody know of a way to return just the file name (without the full path) using the OpenFileDialog? Example: OpenFileDialog.FileName returns ‘c:\dir1\textfile.txt’ But I want OpenFIleDialog.?? To return ‘textfile.txt’ Thanks Brad

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Run the full path trough the Path.GetFileName Method[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      A B 2 Replies Last reply
      0
      • D Dave Kreskowiak

        Run the full path trough the Path.GetFileName Method[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        A Offline
        A Offline
        AndrewVos
        wrote on last edited by
        #3

        And if u want any more info just... dim fileInfo as new io.FileInfo(Path) FileInfo contains alot of extra info.

        D 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Run the full path trough the Path.GetFileName Method[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          B Offline
          B Offline
          Brad Fackrell
          wrote on last edited by
          #4

          Thanks Dave/Andrew. That worked perfect.

          1 Reply Last reply
          0
          • A AndrewVos

            And if u want any more info just... dim fileInfo as new io.FileInfo(Path) FileInfo contains alot of extra info.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            And you're telling me this why? Tell the OP, he'll get an email that say you responded to HIM, not me. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            A 1 Reply Last reply
            0
            • D Dave Kreskowiak

              And you're telling me this why? Tell the OP, he'll get an email that say you responded to HIM, not me. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              A Offline
              A Offline
              AndrewVos
              wrote on last edited by
              #6

              What the hell r u talking about Dave?

              D 1 Reply Last reply
              0
              • A AndrewVos

                What the hell r u talking about Dave?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                When you reply to a post, CodeProject sends an email to the person who you replied to. Since you replied to me, only I got the message that you posted a reply to one of my posts. I didn't ask a question or wanted any more information, but the person who Originally Posted the question could have used the information y you posted in a reply to me. Reply to the OP and he/she will get the message that you replied to him/her. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                A 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  When you reply to a post, CodeProject sends an email to the person who you replied to. Since you replied to me, only I got the message that you posted a reply to one of my posts. I didn't ask a question or wanted any more information, but the person who Originally Posted the question could have used the information y you posted in a reply to me. Reply to the OP and he/she will get the message that you replied to him/her. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  A Offline
                  A Offline
                  AndrewVos
                  wrote on last edited by
                  #8

                  ahh true :) I see I clicked the wrong one there :)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups