|
-
Mar 29th, 2012, 09:15 PM
#1
Thread Starter
Member
[RESOLVED] Error On Embedded resources file even though the data is correct,
the story goes something like this:
i have embedded resource file, a vbs script.
i have an error when i use writeallbytes and it says dimensional error cannot be converted to bytes something like that so i decided to make a module instead of writeallbytes,
what my program does is it writes the content of the script to textbox and after that
this data will be written in a script and will be save on drive C:\ as .vbs.
that is perfectly working on my codes
Code:
Friend Sub writeToFile(ByVal txt As String)
Dim FILE_NAME As String = "C:\myvbs.vbs"
My.Computer.FileSystem.WriteAllText(FILE_NAME, txt & vbnewline, True)
MsgBox("bla blah" & vbCrLf & _
"blah blah" & vbCrLf & _
"Press Okey To Continue...")
End Sub
and the Go Button will call the vbs script
the creation of vbs in drive C:\ is succesfull
even the data inside of it is perfect.
but why if im going to execute and call it with process.start it has an error?
while the original vbs script when i run it doesn have error?
although they have same data inside why?
whats wrong with that?
regards
-
Mar 29th, 2012, 09:41 PM
#2
Re: Error On Embedded resources file even though the data is correct,
If I had to guess, and I do, I'd say that there's an issue with the working directory, which is often the cause of issues when using Process.Start. There's no way for us to know that for sure though when you don't tell us what the error is and where it occurs. If that is the issue then you'll need to create a ProcessStartInfo and set its WorkingDirectory to the path of the folder containing the file you're executing.
-
Mar 29th, 2012, 10:58 PM
#3
Thread Starter
Member
Re: Error On Embedded resources file even though the data is correct,
I'd say that there's an issue with the working directory
so its better to use special folder for example the appdata folder?
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
i will try to do the screenshot with the error and i will post the code here later
thanks sir
-
Mar 29th, 2012, 11:02 PM
#4
Re: Error On Embedded resources file even though the data is correct,
 Originally Posted by eyestrain
so its better to use special folder for example the appdata folder?
Assuming that this issue even is related to the working directory, where the folder is makes no difference whatsoever. All that matters is that you specify the correct working directory, which would normally be the folder containing the file you're executing.
That said, it is never a good idea to save a file to the root of the system drive. Windows has lots of standard folders for various purposes and you should pretty much always be using one of those.
-
Mar 29th, 2012, 11:30 PM
#5
Thread Starter
Member
-
Mar 30th, 2012, 12:01 AM
#6
Thread Starter
Member
Re: Error On Embedded resources file even though the data is correct,
problem solve!
i make it default encoding and i add this code on my codes
IO.File.WriteAllText(FILE_NAME, txt, System.Text.Encoding.Default)
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|