Vb.net (2005) have a nice function to get the CurrentUser/ApplicationData directory,
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
It will return a string like:
"C:\Documents and Settings\TheUser\Application Data\TheCompany\TheProduct\TheFileVersion"
BUT
You will not get same directory if the application is installed using ClickOne deployment!
Then it will return something like:
"C:\Documents and Settings\TheUser\Local Settings\Apps\2.0\
Data\Z5EKHRYM.NA38XHZG83D.VVDcanw..tion_21e
42ebf29780e48_0000.003c_10438657c4e73ebc\Data"
And if your upgrade your application using the ClickOne then you will get another directory
for that version of your application.
So stored files or data for your application will not be found.
Work around:
Use System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
that returns "C:\Documents and Settings\TheUser\Application Data".
Then Add "\TheCompany\TheProduct\"
Code:
Public LocalAppDataDir As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + _
"\TheCompany\TheProduct"
' Also run this to create the directory if it doesn't exists:
' Determine whether the directory exists.
If Directory.Exists(LocalAppDataDir) = False Then
Console.WriteLine("Create Dir {0}.", LocalAppDataDir)
' Try to create the directory.
Dim di As DirectoryInfo = Directory.CreateDirectory(LocalAppDataDir)
Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(LocalAppDataDir))
End If
Monday, June 22, 2009
Sunday, June 07, 2009
Sqlite database
Have been using Sqlite now with vb.net for a while, a nice experience I can say.
Here are some useful links.
Sqlite Database homepage
Using Sqlite in vb.net fr
Sqlite Administrator Database editor.
Here are some useful links.
Sqlite Database homepage
Using Sqlite in vb.net fr
Sqlite Administrator Database editor.
Subscribe to:
Posts (Atom)
MySQL to MariaDB
Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...
-
When converting an VB2008 application to VB2010 I run into trouble regarding COM objects while compiling. you get errors like: Error 1...
-
In a module you have declared a Structure or Enum that you will use through out a project. Module Module1 Public Structure dummy ...
-
Apache2 crashes on Ubuntu Linux 22.04.5 after Zabbix was updated to 7.0.26 During a upgrade of my Ubuntu server there was a new package for ...