inifile for startup options

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

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
 
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
 
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
 
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
 
* alex said:
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 ?

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
///
 
Just curious why no one uses the Configuration Management Application Block?
Mircosoft has a whole interface dedicated to it.

Gary
 
Back
Top