SolvedConversion From 'String' " " To Type 'Double' Not Valid

Posts 1–9 of 9 · Page 1 of 1
Conversion From 'String' " " To Type 'Double' Not Valid
I am making a program that downloads programs to %appdata% folder, i was able to get to the folder, i have downloading done, but when i debug and test, i get this error! It is 100% correct but it isnt working (using imports system.environment, and it worked before).

The code i use was "dim launch as string = getfolderpath(specialfolder.applicationdata + "program.exe" with "file.exists". I googled it but no avail . Please help!

Ps using the mobile version.
Try using & rather than +.
Both "+" and "&" can be used for concatenation in Vb.net. However vb.net understands the context of "&" better and won't end up attempting to "+" (add) the string, which will give you the error you mentioned above. Your result is a Valid String but not a Valid Double. Usually this is a "problem" you see when Option Explicit is ON because Option Explicit ON will disallow the explicit conversion of String to Double. But it's a good idea to keep it on, so "&" is the better method.

Kevin had it right, I just wanted to quickly explain why, because (IMO) if you don't understand why, you may continuously make the same "mistake".
I tried with the & but it still gives me an error.

"Conversion from string "26\program.exe" to type 'integer' is not valid" using the same source but with an ampersand.

Edit; nevermind. /solved i just used a different method.
Quote Originally Posted by ecaep42 View Post
I tried with the & but it still gives me an error.

"Conversion from string "26\program.exe" to type 'integer' is not valid" using the same source but with an ampersand.
That is because when you will try to convert a non-integer to an integer, it will throw an error. Also, post your code if you want further help.
Apparently it's been solved. But in the future we request (if nothing else) Declarations and any source related to the issue "&" the source before and after the break.
Quote Originally Posted by NextGen1 View Post
Apparently it's been solved. But in the future we request (if nothing else) Declarations and any source related to the issue "&" the source before and after the break.
I just changed "dim blahblah as string = thatcode()" to "Process.Start(appdata & "\Program.exe")".
Because you had your closing parenthesis in the wrong spot for 'GetFolderPath' function.

It *should* have been:
Code:
Dim appDataPath As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "program.exe")
GOD DAMN ! SUCH A NOOB.
Marked Solved.
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?