Results 1 to 13 of 13

Thread: problems saving to the registry

  1. #1

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    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



  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Thumbs up

    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

  3. #3

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    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

  4. #4

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Unhappy

    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

  5. #5
    Guest
    Does it give the same error? or does your own customized error box pop up?

  6. #6

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    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

  7. #7
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Question

    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...

  8. #8

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    vb5 enterprise

  9. #9
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Question

    I'm really not sure what is wrong. Let me look around a bit and see what I can find.

  10. #10

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    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

  11. #11
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126
    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

  12. #12

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Talking

    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.

  13. #13

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    36

    Angry

    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
  •  



Click Here to Expand Forum to Full Width