Results 1 to 15 of 15

Thread: [VB6] OCX settings not saving

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    [VB6] OCX settings not saving

    I just found some code snippets on google to create propreties for a UserControl. The problem is they won't save when I modify them in the proprieties in the IDE... I'm new to ActiveX etc, so can you please be clear? I could also upload the entire project, because I really want this to be fixed... Thanks for reading!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VB6] OCX settings not saving

    Welcome to the forums.

    Do you get some kind of error message or does it look like it is saving them, but when you reload the project they aren't there?

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    Thanks for the welcome!!! However, when I put them I don't get errors, but when I set the property and then run the program the setting becomes blank...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VB6] OCX settings not saving

    What settings are you try to establish?

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    I attached the project. I think there's something wrong with the properties :S
    Attached Files Attached Files

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VB6] OCX settings not saving

    There are two user control files in the project.

    Which one are you having a problem with?
    What settings are you trying to change/set (I will try to change/set the exact same ones.)

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    tha problem is with the neoAuth.ctl Control. I can't get ProgramName and NeededLevel to work...

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VB6] OCX settings not saving

    I get this when I load the project
    Quote Originally Posted by ricky92's project
    Line 12: Property ToolboxBitmap in NeoFriendsAuth had an invalid file reference.
    Line 21: Property Picture in Picture1 had an invalid file reference.
    Have you gotten this before?

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    it's just the image in the picturebox... I included it in the project but I think it's not loading because of the directory change...

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VB6] OCX settings not saving

    How are you attempting to set these two?

  11. #11

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    I'm trying to set them from the propreties sidebar!!!

  12. #12

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: [VB6] OCX settings not saving

    Sorry for double posting, but I need serious help!!!

  13. #13

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Ending a program from a OCX

    I don't know how to do that.. If I put End it won't compile!!!

  14. #14
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [VB6] OCX settings not saving

    Most of the "load errors" in the IDE are bcause you did not include the .ctx files for the 2 UserControls.

    There is also a funky reference path to your modPete.bas module in the .vbp file that needs cleaning up. Open it with NotePad to fix it.


    You are missing event handlers in the UserControls for the Readproperties() and WriteProperties() UserControl events. This is how design-time settings get stored and loaded.


    Man, please try a little whitespace in your code. A blank line between Functions and Subs goes a long way, and indenting to show the scope of code helps a whole lot.


    Option Explicit is your friend. You should have the IDE option set to automatically add this line whenever you create a module:

    Menu: Tools|Options...

    Editor tab: check "Require Variable Declaration."


    See the VB6 documentation for details on creating a UserControl. Be careful with stuff you find on the Internet. There is a lot of lousy example code out there!

    Hopefully you have the CDs that came with VB6. Microsoft has pulled a lot of the VB6 documentation off their web sites.

  15. #15
    Member
    Join Date
    Oct 2006
    Location
    Noida,India
    Posts
    49

    Re: [VB6] OCX settings not saving

    You have to write code inside

    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    End Sub

    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    End Sub

    i.e you have to write all you properties to PropBag in WriteProperties event of your control and you have to use ReadProperties Event to read back all properties from PropBag.

    PropBag is used to save the properties of controls.
    Rajneesh

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