写一个套打程序,所有数据都是保存到类中的,如何把这个类中的所有数据保存到文件中,VC中有序列化,
VB下怎么实现 ,有没有办法?

解决方案 »

  1.   

    不清楚VC,但写到INI文件中也是很方便的.读出来也一样.
      

  2.   

    XML想过的,只是有图片数据怎么办!,也可以么
    我看看
      

  3.   

    在 ReadProperties  事件中读取保存在PropertyBag 对象的数据
    在 WriteProperties 事件中写数据到PropertyBag 对象里
      

  4.   

    下面是我一个 图片按钮(是UserControl, class好像没有这个事件 不知道 直接定义一个PropertyBag 来保存数据行不行 小弟没试过)的 代码的一部分 楼主参考一下'读取所有保存在PropertyBag 对象的数据到相应的属性, 来初始化属性
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Set PictureNormal = PropBag.ReadProperty("PictureNormal", Nothing)
        Set PictureDown = PropBag.ReadProperty("PictureDown", Nothing)
        Set PictureOver = PropBag.ReadProperty("PictureOver", Nothing)
        Shape = PropBag.ReadProperty("Shape", sb_stlEllipse)
        AutoSize = PropBag.ReadProperty("AutoSize", False)
        BackColor = PropBag.ReadProperty("BackColor", False)
        WidthEllipse = PropBag.ReadProperty("WidthEllipse", 20)
        HeightEllipse = PropBag.ReadProperty("HeightEllipse", 20)
    End Sub'保存属性值到PropertyBag里 以便下次启动时 来恢复其值
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        Call PropBag.WriteProperty("PictureNormal", PictureNormal, Nothing)
        Call PropBag.WriteProperty("PictureDown", PictureDown, Nothing)
        Call PropBag.WriteProperty("PictureOver", PictureOver, Nothing)
        Call PropBag.WriteProperty("Shape", Shape, sb_stlEllipse)
        Call PropBag.WriteProperty("AutoSize", AutoSize, False)
        Call PropBag.WriteProperty("BackColor", BackColor, False)
        Call PropBag.WriteProperty("WidthEllipse", WidthEllipse, 20)
        Call PropBag.WriteProperty("HeightEllipse", HeightEllipse, 20)
    End Sub