Change file type in vb / vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    Change file type in vb / vb.net

    Ok here's one for the experts...

    I want to create a text file "test.text" that stores different values on each line.

    Is it possible for me to go to the directory its saved and change the extension to test.abc, then when i open it in vb/vb.net is converts the file back to test.text before opening it.

    So in english...
    I have a file called test.abc, which is technically a notepad file that storing values that i dont want beginers to open. (Dont worry values will be encrypted anyways :))
    Then when i read from it needs the extension changed from .abc to .text again before opening it to read the values in vb.

    is this possible?

    Thanks James
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    Answer my own question again :)

    It is possible
    i used this.
    FileSystem.Rena me("Filename", "Filename2" )

    Comment

    • Ali Rizwan
      Banned
      Contributor
      • Aug 2007
      • 931

      #3
      Originally posted by jamesd0142
      Answer my own question again :)

      It is possible
      i used this.
      FileSystem.Rena me("Filename", "Filename2" )
      Hey buddy,

      Dont use fso.rename

      If you have made test.abc using notepad or you have made this textfile using fso you can open it in vb either file extension is txt or anyone else like jpg, bmp, abc, mon, it can be a sys file or a exe file.
      I ll send you a sample but not now after some time because i have to logout now.
      But

      GOODLUCK
      And Wait for the sample unless you ma de it yourself
      ALI

      Comment

      • jamesd0142
        Contributor
        • Sep 2007
        • 471

        #4
        ok cheers for that.

        so if i understand... you can read lines from a text file, even tho the extenstion is no longer .text/.txt?

        Thanks

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by jamesd0142
          so if i understand... you can read lines from a text file, even tho the extenstion is no longer .text/.txt?
          Correct. The extension is of no significance whatever. It's just to give the user some idea of what to expect, and to determines how Windows treats the file by default.

          In other words, if you have a file with a .TXT extension and you just tell Windows to open it, it will start up Notepad (or TextPad, or whatever application you have said TXT files belong to). But you can also tell it to "open with ..." any program you want. In other words, the extension is sort of a "hint" as to who would normally be expected to deal with the file, but this is not enforced.

          Comment

          Working...