[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!
Re: [VB6] OCX settings not saving
Welcome to the forums. :wave:
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?
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...
Re: [VB6] OCX settings not saving
What settings are you try to establish?
1 Attachment(s)
Re: [VB6] OCX settings not saving
I attached the project. I think there's something wrong with the properties :S:confused:
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.)
Re: [VB6] OCX settings not saving
tha problem is with the neoAuth.ctl Control. I can't get ProgramName and NeededLevel to work... :(
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?
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...
Re: [VB6] OCX settings not saving
How are you attempting to set these two?
Re: [VB6] OCX settings not saving
I'm trying to set them from the propreties sidebar!!!
Re: [VB6] OCX settings not saving
Sorry for double posting, but I need serious help!!!
Ending a program from a OCX
I don't know how to do that.. If I put End it won't compile!!!
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.
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.