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. C#
  4. Type File

Type File

Scheduled Pinned Locked Moved C#
helpquestion
4 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.
  • T Offline
    T Offline
    T EDY
    wrote on last edited by
    #1

    Hi all, Can Anyone tell me how i can check the type of a file?I mean i want to add checking file if the file not a .doc files then i want to show message box To show that the file extension is not .doc files Thank U For The Help :-D

    Regards, Tomi

    T 1 Reply Last reply
    0
    • T T EDY

      Hi all, Can Anyone tell me how i can check the type of a file?I mean i want to add checking file if the file not a .doc files then i want to show message box To show that the file extension is not .doc files Thank U For The Help :-D

      Regards, Tomi

      T Offline
      T Offline
      T EDY
      wrote on last edited by
      #2

      Already solved by using FileInfo.Extension Thank U

      Regards, Tomi

      V S 2 Replies Last reply
      0
      • T T EDY

        Already solved by using FileInfo.Extension Thank U

        Regards, Tomi

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        That is a basic check. It will not work if a DOC file is named, say, XLS. To be sure, you have to look at the file header.

        Cheers, Vikram.


        "I will put my new found knolage to good use" - Captain See Sharp. "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.

        1 Reply Last reply
        0
        • T T EDY

          Already solved by using FileInfo.Extension Thank U

          Regards, Tomi

          S Offline
          S Offline
          Scott Dorman
          wrote on last edited by
          #4

          The right way to do this is going to be using the SHGetFileInfo Win32 API. You will need to retrieve the SHGFI.TYPENAME value.

          Scott. —In just two days, tomorrow will be yesterday. —Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai


          [Forum Guidelines] [Articles] [Blog]

          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