Braydo25 Posted October 7, 2008 Author Share Posted October 7, 2008 Lol, well this is making me pretty mad. Im trying to make a function that checks if there is a variable within an ini.I tried something like:public function CheckINIVar (EventName as string) as boolean dim a as integer on error goto Error for i = 0 to 10 if getvar(app.path(blah blah blah),header,EventName) = i then <– Eventname is the name of the var it looks for CheckINIVar = true end if Errorend functionbut this always returns false, since getvar returns a string and a for loop must use integers in the var. so strings cant = integers (duh)so, to fully explain it: This function needs to return TRUE if there is a variable named whatever EventName in CheckINIVar (EventName as string) is. and if there is not a variable named that then it returns a FALSE.anyone got an idea? Link to comment Share on other sites More sharing options...
unnown Posted October 7, 2008 Share Posted October 7, 2008 val(string) might work Link to comment Share on other sites More sharing options...
Braydo25 Posted October 8, 2008 Author Share Posted October 8, 2008 nvm, i was being dumb. I overlooked a really simple way to do it, instead i just did: Public Function CheckEvent(EventName as string) as boolean if getvar(blahblahblah,blah,EventName) = "" then CheckEvent = false else CheckEvent = true end ifend function.lol, i forgot that when the variable isnt found it returns a vbnullstring. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 8, 2008 Share Posted October 8, 2008 if getvar(…) = vbnullstring should work too... Link to comment Share on other sites More sharing options...
unnown Posted October 8, 2008 Share Posted October 8, 2008 vbnullstring is even better :) Link to comment Share on other sites More sharing options...
shadowwulf Posted October 9, 2008 Share Posted October 9, 2008 yay! im getting smarter!i usually use vbnullstring to figure out if im starting something new so i thought it was the best way. 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