Property Bag alternative - Data Bag Class
This is an alternative to Property Bag class. It supports all variable types except vbObject, vbDataObject and vbUserDefinedType.
(For the vbVariant , it now only supports byte array.) The advantage is its portability. It has all methods same as Property Bag class.
Supported types:
DataBag.cls
Usage:
This is an alternative to Property Bag class. It supports all variable types except vbObject, vbDataObject and vbUserDefinedType.
(For the vbVariant , it now only supports byte array.) The advantage is its portability. It has all methods same as Property Bag class.
Supported types:
- vbEmpty
- vbNull
- vbInteger
- vbLong
- vbSingle
- vbDouble
- vbCurrency
- vbDate
- vbString
- vbBoolean
- vbVariant(used only byte array)
- vbDecimal
- vbByte
DataBag.cls
Usage:
Code:
Dim DB As New DataBag
DB.WriteProperty "test", "ok"
DB.WriteProperty "init", True
Dim b() As Byte
ReDim b(2)
b = StrConv("ASD", vbFromUnicode)
DB.WriteProperty "byte array", b
DB.WriteProperty "date value", Now()
DB.WritetoFile App.path & "\testDB.txt"
Set DB = Nothing
Set DB = New DataBag
DB.ReadFromFile App.path & "\testDB.txt"
Debug.Print StrConv(DB.ReadProperty("byte array"), vbUnicode)
Debug.Print DB.ReadProperty("init")
Debug.Print DB.ReadProperty("test")
Debug.Print DB.ReadProperty("date value")
Debug.Print DB.ReadProperty("nothing", Null)
' Debug.Print DB.ReadProperty("nothing")' raises an error same as Property Bag
'DB.Contents ' Same as Property Bag