I know a lot people are confused to why their application works on XP but not Vista. The basis of this tutorial is examine, explain and offer solutions.
Let's take this simple console application.
CODE
Module Module1
Sub Main()
Console.WriteLine(My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData)
Console.ReadLine()
End Sub
End Module
When run on;-
VistaC:\ProgramData\ConsoleApplication1\ConsoleApplication1\1.0.0.0XPC:\Documents and Setting\All Users\Application Data\ConsoleApplication1\ConsoleAppliction1\1.0.0.0Two totally different locations.
TIP 1 Don't hard code any file locations.
Example 2: The location of the .EXE
CODE
Module Module1
Sub Main()
Console.WriteLine(System.Windows.Forms.Application.ExecutablePath)
Console.ReadLine()
End Sub
End Module
Add a reference to the
System.Windows.Forms namespace
VistaC:\Users\Adam Speight\AppData\Local\Temporary Projects\ConsoleApplication1\bin\Debug\ConsoleApplication1.EXEXPc:\Documents and Settings\Adam Speight\Local Setting\Application Data\Temporary Project\ConsoleApplication1\ConsoleApplication1.EXETIP 2 Don't hard code any file locations.
More examples to follow.