bigred Posted November 4, 2004 Share Posted November 4, 2004 I seem to have a problem with iniWrite in VB6 when I try and write an empty string to the key. Is there any way to clear out a key? I could have the code replace an empty string with something that I could handle later when I go to read the string, but thats not preferable. Any ideas? Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 4, 2004 Share Posted November 4, 2004 Have you tried vbNull or vbStringNull? These might erase the value. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
bigred Posted November 4, 2004 Author Share Posted November 4, 2004 (edited) Ok, so you're saying set the string to one of those and then try and write it to the ini key? I'll give it a try. EDIT: Weird, it seems to have written "1 " (a one and a space) to the key when I use vbNull. Any ideas? Also vbStringNull didn't work. VB6 thought it was a variable. Edited November 4, 2004 by bigred Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 4, 2004 Share Posted November 4, 2004 vbStringNull is a variable, you could try sending that as your IniWrite parameter. I assume that in your code you set a string = vbNull, try changing its data type to a variant and see if that works. other than that without seeing your code there isn't a lot I can do to help. Hope something here was of assitsance! *** Matt @ MPCS Link to comment Share on other sites More sharing options...
bigred Posted November 4, 2004 Author Share Posted November 4, 2004 vbStringNull is a variable? I don't understand how that is helpful here? No I don't set the string to equal vbNull, when I do that it writes a "1" to the key. Here's the chunk of code I'm reffering too. If ListSelMaps.ListIndex = -1 Then Exit Sub For iCounter = 0 To ListSelMaps.ListCount - 1 ListSelMaps.Selected(iCounter) = False ListSelMaps.Selected(iCounter) = True If ListSelMaps.Selected(iCounter) = True Then Select Case iGameMode Case 1 sDA_Maps = sDA_Maps & ListSelMaps.Text & "," Case 2 sLC_Maps = sLC_Maps & ListSelMaps.Text & "," Case 3 sDM_Maps = sDM_Maps & ListSelMaps.Text & "," End Select End If ListSelMaps.Selected(iCounter) = False Next iCounter Select Case iGameMode Case 1 If sDA_Maps = "" Then aix.IniWrite sTSMdata, "MAPS", "DiscArenaSelected", sDA_Maps Exit Sub Else aix.IniWrite sTSMdata, "MAPS", "DiscArenaSelected", sDA_Maps End If Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 5, 2004 Share Posted November 5, 2004 Well I am fresh out of ideas for using AutoIt to do it. You could always access the registry api directly. Search Planetsourcecode.com for ways to do this. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
bigred Posted November 5, 2004 Author Share Posted November 5, 2004 The registry? I'm working with an ini file. Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted November 5, 2004 Share Posted November 5, 2004 Sorry that is what I meant... the functionality is almost identical for the API. It was late when I posted that so forgive a sleepy man. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
bigred Posted November 5, 2004 Author Share Posted November 5, 2004 Heh, no worries. I'll check out that site you mentioned. Thanks. Link to comment Share on other sites More sharing options...
bigred Posted November 6, 2004 Author Share Posted November 6, 2004 I checked it out. Still no go. Why does the autoitx iniwrite command crash the program? Anyone have any ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now