Hi Ryan,



How are you? You said you were going to have more time around December.

So now that December is here, how is your time?



Listen there, I have some problems with a procedure of saving settings.

The settingholder looks like this:

Property1 = Value1

Property2 = Value2

Property3 = Value3



I need the settinger procedure to, for example set Property2 to ValueXY

and set Property4 to Value4. Neatly this should result in something like

this:

Property1 = Value1

Property3 = Value3

Property2 = ValueXY

Property4 = Value4



Unfortunately my procedure sometimes refuses to function... but only

sometimes, so I have no clues for debugging it.



Here is it's code:

--- Begin quote ---

Sub xSet(xName As String, xProperty As String, xValue As String)

''Set filenames

xFile$ = Window.NodeInfoPath + "\" + xName

SwapFile$ = Environ$("TEMP") + "\ICIC.SWP"



''Find Property in file and save the remaining data in the swap file

Open SwapFile$ For Output As #2

Open xFile$ For Input As #1

Found = False

Do: Input #1, a$

 ''If the thing behind the "=" is our property...

 If UCase$(Trim$(Mid$(a$, 1, InStr(a$, "=") - 1))) =

UCase$(Trim$(xProperty)) Then

  Found = True

 Else

  ''Otherwise copy to the swapfile

  Print #2, a$

 End If

Loop Until EOF(1) Or a$ = ""

Close #1, #2



If Not Found Then

 ''If property not already inside, append it

 Open xFile$ For Append As #2

 Print #2, xProperty; "="; xValue

 Close #2

Else

 ''If property inside, put it in the swap file and switch them

 Open SwapFile$ For Append As #2

 Print #2, xProperty; "="; xValue

 Close #2

 Kill xFile$

 Name SwapFile$ As xFile$

End If

Kill Environ$("TEMP") + "\ICIC.SWP"

End Sub

---- End quote ----



You may of course want to rewrite the thing entirely, in wich case I

give you the modlue, which you alter (it only contains the code for

setting manipulation).



Well, C'ya!



--



Don't feel bad about asking/telling me anything, I will always gladly

reply.



Digging for info? Try AI Meta Search:

Http://WWW.AIMetaSearch.Com



MesonAI -- If nobody else wants to do it, why shouldn't we?(TM)

Http://WWW.MesonAI.Com

