|
-
May 16th, 2000, 05:15 AM
#1
Thread Starter
Member
Ok I am having problems saving some button setups to the registry. In the button to save it to the registry I have this
SaveSetting App.Title, "Settings", "buttontag", pvarButton.Tag
SaveSetting App.Title, "Settings", "buttontooltiptext", pvarButton.ToolTipText
SaveSetting App.Title, "Settings", "buttoncaption", pvarButton.Caption
the pvarbutton stuff is some things I did to make the coding easier for some other stuff
in the load button i have this
On Error Resume Next
pvarButton.Tag = GetSetting(App.Title, "Settings", "buttontag")
On Error Resume Next
pvarButton.ToolTipText = GetSetting(App.Title, "Settings", "buttontooltiptext"
On Error Resume Next
pvarButton.ToolTipText = GetSetting(App.Title, "Settings", "buttoncaption"
but i do not see the problem in it
if you can help please do so
-
May 16th, 2000, 05:40 AM
#2
Fanatic Member
You were almost there... Try this instead. I've simplified it a bit and but an error handler in so that if it is returning an error you can let us know what it is:
Private Sub LoadSettings()
On Error GoTo err1
pvarButton.Tag = GetSetting(App.Title, "Settings", "buttontag")
pvarButton.ToolTipText = GetSetting(App.Title, "Settings", "buttontooltiptext")
pvarButton.Caption = GetSetting(App.Title, "Settings", "buttoncaption")
Exit Sub
err1:
MsgBox Err.Number & ":" & vbCrLf & Err.Description, vbCritical, "Error"
End Sub
Private Sub pvarButton_Click()
On Error GoTo err2
SaveSetting App.Title, "Settings", "buttontag", pvarButton.Tag
SaveSetting App.Title, "Settings", "buttontooltiptext", pvarButton.ToolTipText
SaveSetting App.Title, "Settings", "buttoncaption", pvarButton.Caption
Exit Sub
err2:
MsgBox Err.Number & ":" & vbCrLf & Err.Description, vbCritical, "Error"
End Sub
-
May 16th, 2000, 05:49 AM
#3
Thread Starter
Member
ok i put in that exact coding
and it seems to save it fine... i guess
but when i go to load them it brings up an error
Error
91:
Object variable or With block variable not set
-
May 16th, 2000, 05:51 AM
#4
Thread Starter
Member
ok if i keep the program runnning it will load them fine, but if i close the program and try to load them again it doesnt work
-
May 16th, 2000, 06:00 AM
#5
Does it give the same error? or does your own customized error box pop up?
-
May 16th, 2000, 06:02 AM
#6
Thread Starter
Member
the same error comes up
but it loads them if i dont close the program but if i close the program it brings up the error when i try to load them
-
May 16th, 2000, 06:03 AM
#7
Fanatic Member
What version of VB are you using? I've been using this code for a long time and I've never seen the error in this place before...
-
May 16th, 2000, 06:04 AM
#8
Thread Starter
Member
-
May 16th, 2000, 06:36 AM
#9
Fanatic Member
I'm really not sure what is wrong. Let me look around a bit and see what I can find.
-
May 16th, 2000, 06:43 AM
#10
Thread Starter
Member
ok
i dont see what the problem in it could be though
i thought for sure mine should have worked, but it didnt and then theres a problem in yours
this is just all messed up
-
May 16th, 2000, 12:03 PM
#11
Lively Member
Try this code... last param is default, in the case that the registry settings you are extracting doesn't exist the default value is used!
Private Sub LoadSettings()
On Error GoTo err1
pvarButton.Tag = GetSetting(App.Title, "Settings", "buttontag", "Open File")
pvarButton.ToolTipText = GetSetting(App.Title, "Settings", "buttontooltiptext", "Click to open a file")
pvarButton.Caption = GetSetting(App.Title, "Settings", "buttoncaption", "&Open")
Exit Sub
err1:
MsgBox Err.Number & ":" & vbCrLf & Err.Description, vbCritical, "Error"
End Sub
Private Sub pvarButton_Click()
On Error GoTo err2
SaveSetting App.Title, "Settings", "buttontag", pvarButton.Tag
SaveSetting App.Title, "Settings", "buttontooltiptext", pvarButton.ToolTipText
SaveSetting App.Title, "Settings", "buttoncaption", pvarButton.Caption
Exit Sub
err2:
MsgBox Err.Number & ":" & vbCrLf & Err.Description, vbCritical, "Error"
End Sub
Regards,
 Paul Rivoli 
---------------------
[email protected]
http://members.dingoblue.net.au/~privoli
-
May 17th, 2000, 12:17 AM
#12
Thread Starter
Member
Thanks, I hope this works, but I can't try right now because im in school, but as soon as I get home I am gonna try that code. Thank you both for helping me. Like I said I hope this works, but I can't try now because im in school. Thanks Again.
-
May 17th, 2000, 09:31 AM
#13
Thread Starter
Member
Sorry privoli. That didn't work. I don't know what could be wrong with this thing. It's like nothing will work. I don't know how many different things I've troed, and none of them work.
If anybody else can help please do.-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|