![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I'm creating my first (simple) application and I like to save the config..
I have been playing around with this this Which works, but i'd like to see "name=value" in the config file.. I've already adapted the write part, but the reading part is giving me headaches So my question to you is ![]() The code in the tutorial is reading the ini file line by line, this also prevents comments (which I would also like :-) I think I might be able to use the StrIndexOf and then a StrSlice, but first things first.. I was thinking something like the below to start with (bold part is changed) Code:
Sub LoadINI
ErrorLabel(errLoadINI)
If Not(FileExist("Config.ini")) Then Return
FileOpen(c2,"Config.ini",cRead)
CheckBox1.Checked = StrSplit(FileRead(c2),"=")
CheckBox2.Checked = StrSplit(FileRead(c2),"=")
FileClose(c2)
Return
errLoadINI:
Msgbox("Error reading INI file.","",cMsgboxOK,cMsgboxHand)
FileClose(c2)
End Sub
Because i'm not specifying which part of the split I want to use... I couldn't find how to do this, I tried the JScript way, but that didn't work :-( Any help is highly appreciated Thanks! |
|
|||
|
Quote:
Maybe i should put in a function which does a StrToLower and StrReplace spaces, just to be sure Thanks for the help ![]() |
|
||||
|
Hi All,
look at the thread "db2000 - INI" in "Italian Forum" (db2000 - INI)... Is it useful to Your need? |
|
||||
|
Hi Mr_Gee
in db2000 - INI library (DLL version) there are two operating modes whose functions are very simple: MODE 1 ' initialize mode 1 .New1([INIFileName]) ' example: INI.New1("test.ini") ' write or update a row into INI file .write1([Section], [Key], [Value]) ' example: INI.write1("USER", "Name", "maXim") ' read a row from INI file .read1([Section], [Key], [DefaultValue]) ' example: myVAR = INI.read1("USER", "Name", "empity") ' if row not exist or is not valid, value of myVar is equal as [DefaultValue] ' delete from INI file a specific [Section] and all his keys .DeleteSection1([Section]) ' example: INI.DeleteSection1("USER") MODE 2 ' initialize mode 2 .New2 ' example: INI.New2 ' write or update a row into INI file ([INIFileName]) .write2([INIFileName], [Section], [Key], [Value]) ' example: INI.write2("test.ini", "USER", "Name", "maXim") ' read a row from INI file ([INIFileName]) .read2([INIFileName], [Section], [Key], [DefaultValue]) ' if row not exist or is not valid, value of myVar is equal as [DefaultValue] ' example: myVAR = INI.read2("test.ini", "USER", "Name", "empity") ' delete from INI file ([INIFileName]) a specific [Section] and all his keys .DeleteSection2([INIFileName], [Section]) ' example: INI.DeleteSection2("test.ini", "USER") I am always available for You if has difficulty of use or if it needs more clarification. Best Regards. Massimo Last edited by maXim : 03-15-2008 at 12:11 PM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need for exe.config file? | aureolevoyager | Questions & Help Needed | 2 | 03-01-2008 09:15 AM |
| exe.config problem | agraham | Bug Reports | 1 | 01-13-2008 07:54 AM |
| Reading ini file values into a combox-list | Softselect | Questions & Help Needed | 2 | 11-15-2007 04:41 AM |
| what's app.exe.config | blackiice | Questions & Help Needed | 3 | 10-23-2007 01:38 PM |
| ? Just a quick question, ****.exe.config | taximania | Questions & Help Needed | 12 | 09-01-2007 08:15 PM |