By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,684 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,684 IT Pros & Developers. It's quick & easy.

inifile for startup options

P: n/a
Hi,
I want to store user preferences in an inifile and load these at startup.

- there may be different users accessing the same applicaton on a pc

What is the best way of doing this in vb.net ?

- i prefer not to use the registry
- also, is it possible to read the inifile before any form is loaded? I
want to have a language specificaton in it and would like to set the
culture at the very begining.

Any advise on this would be appreciated

Thanks
Alex

Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Alex,

I'll only answer one part.

If you use Sub Main as your starting point, you can do plenty of stuff
before you even sniff at a Form.

Regards,
Fergus
Nov 20 '05 #2

P: n/a
Cor
Alex,
The most easy one in my opinion is to use very simple XML files (two or
three nodes, no attributes).
And the language culture in the the first root
I prefer for this XMLdoc.load and just proces the nodes.
But there are plenty of other possibilities,
I hope this helps you.
Cor
Nov 20 '05 #3

P: n/a
Cor
Hi Fergus,

It is a good answer I did not see it and when I had seen it, my answer would
be been worse.

But I see this "sub main" answer often and I am thinking than, what would
it botter me (if I don't use the designer) at what time the things are done
if the page is not yet shown at the user.

So I am curious what's the benefit of it.

Is it because of that a lot of people are used to do this from C or is
there more?

(I don't like modules, values declared as public, etc, but use public values
if i think I have no other easy understandable solution )

Cor
Nov 20 '05 #4

P: n/a
* alex <ai******@hotmail.com> scripsit:
I want to store user preferences in an inifile and load these at startup.
<http://www.palmbytes.de/content/dotnetlibs/optionslib.htm>
- there may be different users accessing the same applicaton on a pc

What is the best way of doing this in vb.net ?
You can store the files in the user's
'SpecialFolder.LocalApplicationData' folder. You can get the path by
calling 'Environment.GetFolderPath'.
- i prefer not to use the registry
- also, is it possible to read the inifile before any form is loaded? I
want to have a language specificaton in it and would like to set the
culture at the very begining.


Set the project's startup object to "Sub Main" and add this code:

\\\
Public Module AppMain
Public Sub Main()

' Read settings here.

' Start application here.
End Sub
End Module
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5

P: n/a
Just curious why no one uses the Configuration Management Application Block?
Mircosoft has a whole interface dedicated to it.

Gary

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bm************@ID-208219.news.uni-berlin.de...
* alex <ai******@hotmail.com> scripsit:
I want to store user preferences in an inifile and load these at startup.

<http://www.palmbytes.de/content/dotnetlibs/optionslib.htm>
- there may be different users accessing the same applicaton on a pc

What is the best way of doing this in vb.net ?


You can store the files in the user's
'SpecialFolder.LocalApplicationData' folder. You can get the path by
calling 'Environment.GetFolderPath'.
- i prefer not to use the registry
- also, is it possible to read the inifile before any form is loaded?

I want to have a language specificaton in it and would like to set the
culture at the very begining.


Set the project's startup object to "Sub Main" and add this code:

\\\
Public Module AppMain
Public Sub Main()

' Read settings here.

' Start application here.
End Sub
End Module
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.