jdsouza Level: Protégé
 Registered: 29-10-2005 Posts: 7
|
Re: property page for OCX?
' Package your propertybag file PBFileName with your ocx
' For the common dialog box control, you have to make a reference to it by adding the control
' to your list of components. The file to make a reference to is COMDLG32.OCX
' You have to package comdlg32.ocx and comdlg32.dep with your application
' Both should be found in your windows system directory.
Public PB As PropertyBag ' module level
Public Sub ReadPropBag()
On Error Resume Next
Dim FILNAME As String
Dim vartemp As Variant
Dim byteArr() As Byte
Dim FF As Long
FF = FreeFile
FILNAME = PBFilename ' Full path to your saved PBfile name
'or you can pass the filename in the sub as Public Sub WritePropBag(PBFilename as string)
Set PB = Nothing
Set PB = New PropertyBag
Open PBFilename For Binary As FF
Get FF, , vartemp
Close FF
byteArr = vartemp
PB.Contents = byteArr
DoEvents
Variable1 = PB.ReadProperty("VName1", "DefaultValue1")
Variable2 = PB.ReadProperty("VName2", "DefaultValue2")
Variable3 = PB.ReadProperty("VName3", "DefaultValue3") ' default values need not be of string datatype.
' Etc
DoEvents
End Sub
Public Sub WritePropBag()
On Error Resume Next
Set PB = Nothing
Set PB = New PropertyBag
PBLic.WriteProperty "VName1", Variable1
PBLic.WriteProperty "VName2", Variable2
PBLic.WriteProperty "VName3", Variable3
' Etc.
DoEvents
Dim FILNAME As String
FILNAME = PBFilename ' saved filename including an arbitary extension example .xxt
'or you can pass the filename in the sub as Public Sub WritePropBag(PBFilename as string)
Kill FILNAME
Dim FF As Long
FF = FreeFile
Open FILNAME For Binary Access Write As FF
Put FF, , PB.Contents
Close FF
DoEvents
End Sub
|