Results 1 to 5 of 5

Thread: Help about resource

  1. #1

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Help about resource

    Hi every body.
    How can i copy a file in my resource to other folder in my computer.

    My file is font file (barcode)
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Help about resource

    When you read the resource from My.Resources you will get it as some type of object. If the original file was a font file then that type may be a Font, otherwise it would be a Byte array. If it's a Byte array then you would be able to call File.WriteAllBytes. If it's a Font then wouldn't need to save it as a file to use it in your app. If you need a file for some other reason then, if it's possible, I think you'd have to use the Windows API to save it. Can you check which type it is?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: Help about resource

    Quote Originally Posted by jmcilhinney View Post
    When you read the resource from My.Resources you will get it as some type of object. If the original file was a font file then that type may be a Font, otherwise it would be a Byte array. If it's a Byte array then you would be able to call File.WriteAllBytes. If it's a Font then wouldn't need to save it as a file to use it in your app. If you need a file for some other reason then, if it's possible, I think you'd have to use the Windows API to save it. Can you check which type it is?
    JM. help me please. IT is array byte().

    I used this :
    Code:
         'Dim binWriter = New IO.BinaryWriter(IO.File.Create("C:\WINDOWS\Fonts\FREE3OF9.TTF"))
                        'binWriter.Write(My.Resources.FRE3O)
                        'binWriter.Close()
                        'Process.Start("C:\WINDOWS\Fonts\FREE3OF9.TTF")
    But it did not work.

    In fact , it work , but that file is not same with original file. And it is not barcode type.
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Help about resource

    I suggest that you go back and read my previous post again.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: Help about resource

    I tried this but it did not work :

    Code:
        Dim strw As New StreamWriter("C:\WINDOWS\Fonts\FREE3OF9.TTF")
                    strw.Close()
                    File.WriteAllBytes("C:\WINDOWS\Fonts\FREE3OF9.TTF", My.Resources.FRE3OF9X)
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

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