Results 1 to 10 of 10

Thread: [RESOLVED] [2008] Trying to use my.resources for a text file

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2007
    Posts
    62

    Resolved [RESOLVED] [2008] Trying to use my.resources for a text file

    Hi everybody

    I have a .txt file in the same folder as my project that is being loaded into an array. I want to get rid of the .txt file and import it into the .exe. So I used the import resources and put it in the text file section of the project. When I use my.resources.lvlxp it gives me an error that there are illegal characters in the path.

    Here is the code for loading from the .txt in the folder:

    Code:
            Dim tempstr As String
            Dim x As Integer = 1
            Dim firstcomma As Integer
            Dim filenum As Integer = FreeFile()
            FileOpen(filenum, "lvlxp.txt", OpenMode.Input)
            Do While Not EOF(1)
                tempstr = LineInput(filenum)
                firstcomma = tempstr.IndexOf(",")
                lvlarray(x) = tempstr.Substring(0, firstcomma)
                xparray(x) = tempstr.Substring(lvlarray(x).ToString.Length + 1, tempstr.Length - lvlarray(x).ToString.Length - 1)
                x += 1
            Loop
            FileClose(1)
    and the code for loading from my.resources:

    Code:
            Dim tempstr As String
            Dim x As Integer = 1
            Dim firstcomma As Integer
            Dim filenum As Integer = FreeFile()
            FileOpen(filenum, My.resources.lvlxp, OpenMode.Input)
            Do While Not EOF(1)
                tempstr = LineInput(filenum)
                firstcomma = tempstr.IndexOf(",")
                lvlarray(x) = tempstr.Substring(0, firstcomma)
                xparray(x) = tempstr.Substring(lvlarray(x).ToString.Length + 1, tempstr.Length - lvlarray(x).ToString.Length - 1)
                x += 1
            Loop
            FileClose(1)
    This is my first time using my.resources and am still pretty new to VB itself..


    Thanks for any and all help.
    Last edited by rhijaen; Dec 1st, 2007 at 07:59 PM.

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