How Can I Make VB Read The config.ini

ItAm
04-27-2003, 02:49 PM
I need to make vb read commands from a config.ini file as an if statement, this is the current if statement:


If Len(varkey) = 16 Then


now, this determines the length of a line in a text file, and does something as a result. what i need is for it for it to read from a config file as well. so pretty much If the key's length = 16 AND 1Load = True Then <--this kind of idea. so in the config, it would say:

[Main]
1Load=True
2Load=False

and if 2load was true, then 1load would be false, etc. this would just user set. i just need it to kinda have the idea as i mentioned before, If Len(varkey) = 16 And "the Stuff i need help with here :)" Then

anyway help would be awesome

phinds
04-27-2003, 04:22 PM
the "sandbox" project at the link below my name has a comple section on how to read and write files; that should get you started.

John
04-27-2003, 04:28 PM
phinds: That doesn't seem to cover anything about ini files :-\

ItAm: Use the following API's GetPrivateProfileString, WritePrivateProfileString

Just follow the links for info about them, and look through the examples they have there.

ItAm
04-27-2003, 04:38 PM
ty, i'll look through both of them, but would anyone be able to just write a quick declaration and an if function? i just need an outline to this idea, i can figure the rest.

phinds
04-27-2003, 07:51 PM
[QUOTEPOST='Orbity']phinds: That doesn't seem to cover anything about ini files :-\
QUOTEPOST]you're correct --- my bad. I see so many posts that imply the user doesn't even know how to open a file that I sometime forget that ".INI" files specifically have functions for their manipulations

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum