SaveSetting and DeleteSetting calls 
Author Message
 SaveSetting and DeleteSetting calls

Has anyone managed to get the SaveSetting and
DeleteSetting routines to work in Visual Basic
4. After trying and failing inside my
application I took the example given in the
help file (listed below) and inserted it into
a clean project - but still no success. Has
anyone a solution ?

Thanks

Dave M.

--

' VB 4 example registry calls.

' Place some settings in the registry.
SaveSetting(appname := "MyApp", section
:= "Startup", _
            key := "Top", setting := 75)
SaveSetting("MyApp","Startup", "Left", 50)
' Remove section and all its settings from
registry.
DeleteSetting("MyApp", "Startup")



Mon, 26 Oct 1998 03:00:00 GMT  
 SaveSetting and DeleteSetting calls

Quote:

>Has anyone managed to get the SaveSetting and
>DeleteSetting routines to work in Visual Basic
>4. After trying and failing inside my
>application I took the example given in the
>help file (listed below) and inserted it into
>a clean project - but still no success. Has
>anyone a solution ?

Are you getting an error message or what?

Quote:
>' Place some settings in the registry.
>SaveSetting(appname := "MyApp", section := "Startup", key := "Top", setting := 75)

I rather doubt this one would work, since it doesn't use anything like VB syntax

Quote:
>SaveSetting("MyApp","Startup", "Left", 50)

This one, however, sure looks like it should work, huh?  Unfortunately, in VB,
if a call doesn't return a value, it's not a function - it's a procedure.  In
VB, you call functions with the syntax

    BB=MyFunc(a,b,c,d)

you call procedures with the syntax

    MySub a, b, c

(note the lack of ()s).

This is usually what trips me up when I use SaveSetting.  Remove the ()s from
the line.  With them, VB thinks ("MyApp","Startup","Left",50) is the first
argument, and that you have chosen not to provide subsequent arguments.

Quote:
>' Remove section and all its settings from
>registry.
>DeleteSetting("MyApp", "Startup")

See notes about second SaveSetting line...

I have been able to get these to work fine for me in both 16-bit and 32-bit.  In
the 32-Bit, the settings are stored in

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\AppName\KeyName

You may not be looking in the right place...

Eric Rossing
Intec Company, Inc.

http://www.msen.com/~rossing



Tue, 27 Oct 1998 03:00:00 GMT  
 SaveSetting and DeleteSetting calls


Quote:
>' Place some settings in the registry.
>SaveSetting(appname := "MyApp", section
>:= "Startup", _
>            key := "Top", setting := 75)
>SaveSetting("MyApp","Startup", "Left", 50)
>' Remove section and all its settings from
>registry.
>DeleteSetting("MyApp", "Startup")

I don't the two are functions; they're subs. try calling them like this:

savesetting "myapp", "startup", "top", 75


--
VB 3.0 and Win3.1x assumed

http://www.sn.no/~balchen/
ftp://ftp.sn.no/user/balchen/



Tue, 27 Oct 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Invalid procedure Call when using Access95 DeleteSetting

2. Calling SaveSetting in FormUnload event

3. DeleteSetting Question

4. deletesetting

5. DeleteSetting help for newbie

6. DeleteSetting...What am I doing wrong?

7. DeleteSetting

8. deleteSetting gives error in vb4/16

9. Bug in DeleteSetting function

10. DeleteSetting in vb4/16 Syntax Error

11. Help Using Deletesetting with my own Ini files

12. DeleteSetting: Does this work in VB?

 

 
Powered by phpBB® Forum Software