vb2005 propertybag

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Galen Somerville

    #1

    vb2005 propertybag

    My vb6 user control used a propertybag. A typical form would use 6 of these
    user controls. The setting of one never affected the others.

    Now I'm supposed to use serialization to replace the property bag.

    But, the examples I have show saving and retrieving from a file. Since the
    file is explicitly named, in the samples, how do I keep the instances
    separate??

    GalenS


  • Homer J Simpson

    #2
    Re: vb2005 propertybag


    "Galen Somerville" <galen@communit y.nospam> wrote in message
    news:%23RwfHgMO GHA.2124@TK2MSF TNGP14.phx.gbl. ..
    [color=blue]
    > My vb6 user control used a propertybag. A typical form would use 6 of
    > these user controls. The setting of one never affected the others.
    >
    > Now I'm supposed to use serialization to replace the property bag.[/color]

    Can't you use collections?
    [color=blue]
    > But, the examples I have show saving and retrieving from a file. Since the
    > file is explicitly named, in the samples, how do I keep the instances
    > separate??[/color]

    Path.GetTempPat h

    My.Computer.Fil eSystem.GetTemp FileName



    Comment

    • Galen Somerville

      #3
      Re: vb2005 propertybag


      "Homer J Simpson" <nobody@nowhere .com> wrote in message
      news:vqtLf.3759 $Cp4.1309@edtnp s90...[color=blue]
      >
      > "Galen Somerville" <galen@communit y.nospam> wrote in message
      > news:%23RwfHgMO GHA.2124@TK2MSF TNGP14.phx.gbl. ..
      >[color=green]
      >> My vb6 user control used a propertybag. A typical form would use 6 of
      >> these user controls. The setting of one never affected the others.
      >>
      >> Now I'm supposed to use serialization to replace the property bag.[/color]
      >
      > Can't you use collections?
      >[color=green]
      >> But, the examples I have show saving and retrieving from a file. Since
      >> the file is explicitly named, in the samples, how do I keep the instances
      >> separate??[/color]
      >
      > Path.GetTempPat h
      >
      > My.Computer.Fil eSystem.GetTemp FileName
      >
      >[/color]
      The following is typed in not copied in.

      in CtrlVol_Load
      If File.Exists("Ct rlVol.bin") Then
      Dim MyFileStream as Stream = File.OpenRead(" CtrlVol.bin")
      Dim deserializer As New BinaryFormatter ()
      CtrlVol = CType(deseriali zer.Deserialize (MyFileStream), CtrlVol)
      MyFileStream,Cl ose()
      End If

      and I assume the reverse in CtrlVol_Leave ??

      So if I get a TempPath/FileName, how do I code it so that's the one used for
      that control.?

      If I use a Global variable for filename in the Main app, does the User
      Control see it?

      GalenS


      Comment

      • Homer J Simpson

        #4
        Re: vb2005 propertybag


        "Galen Somerville" <galen@communit y.nospam> wrote in message
        news:uzjxYeOOGH A.3888@TK2MSFTN GP10.phx.gbl...[color=blue]
        >
        > "Homer J Simpson" <nobody@nowhere .com> wrote in message
        > news:vqtLf.3759 $Cp4.1309@edtnp s90...[color=green]
        >>
        >> "Galen Somerville" <galen@communit y.nospam> wrote in message
        >> news:%23RwfHgMO GHA.2124@TK2MSF TNGP14.phx.gbl. ..
        >>[color=darkred]
        >>> My vb6 user control used a propertybag. A typical form would use 6 of
        >>> these user controls. The setting of one never affected the others.
        >>>
        >>> Now I'm supposed to use serialization to replace the property bag.[/color]
        >>
        >> Can't you use collections?
        >>[color=darkred]
        >>> But, the examples I have show saving and retrieving from a file. Since
        >>> the file is explicitly named, in the samples, how do I keep the
        >>> instances separate??[/color]
        >>
        >> Path.GetTempPat h
        >>
        >> My.Computer.Fil eSystem.GetTemp FileName
        >>
        >>[/color]
        > The following is typed in not copied in.
        >
        > in CtrlVol_Load
        > If File.Exists("Ct rlVol.bin") Then
        > Dim MyFileStream as Stream = File.OpenRead(" CtrlVol.bin")
        > Dim deserializer As New BinaryFormatter ()
        > CtrlVol = CType(deseriali zer.Deserialize (MyFileStream), CtrlVol)
        > MyFileStream,Cl ose()
        > End If
        >
        > and I assume the reverse in CtrlVol_Leave ??
        >
        > So if I get a TempPath/FileName, how do I code it so that's the one used
        > for that control.?
        >
        > If I use a Global variable for filename in the Main app, does the User
        > Control see it?
        >
        > GalenS[/color]

        As long as you don't delete the file it will persist and won't be reused.
        You probably want to put it in a specific directory for your application.
        You can store the name somewhere - the registry perhaps?

        Can't help you much on User Controls







        Comment

        • Peter Huang [MSFT]

          #5
          Re: vb2005 propertybag

          Hi GalenS,

          Also here is sample link about Serialization for your reference.
          Basic Serialization Technology Sample
          http://msdn2.microsoft.com/en-us/library/s4w7yaw2.aspx

          Best regards,

          Peter Huang
          Microsoft Online Partner Support

          Get Secure! - www.microsoft.com/security
          This posting is provided "AS IS" with no warranties, and confers no rights.

          Comment

          • Galen Somerville

            #6
            Re: vb2005 propertybag


            ""Peter Huang" [MSFT]" <v-phuang@online.m icrosoft.com> wrote in message
            news:18u4XXQOGH A.668@TK2MSFTNG XA01.phx.gbl...[color=blue]
            > Hi GalenS,
            >
            > Also here is sample link about Serialization for your reference.
            > Basic Serialization Technology Sample
            > http://msdn2.microsoft.com/en-us/library/s4w7yaw2.aspx
            >
            > Best regards,
            >
            > Peter Huang
            > Microsoft Online Partner Support
            >
            > Get Secure! - www.microsoft.com/security
            > This posting is provided "AS IS" with no warranties, and confers no
            > rights.
            >[/color]
            It turns out that I don't need a propertybag (serialization) . When I leave
            the Form I am done with the UserControls that were used. The next time I
            load that form, the user controls have to be re-initialized for the new
            usage.

            But, I have another problem. In the user control there is a PictureBox on
            the main user control panel. It is smaller than the panel.

            I use the Mouse to determine where to draw a line on the picture box. So
            these are picture box mouse events. They are made Public but they are not
            seen by the test application.

            I have read up on Shadowing and Overides but very confusing. How do I
            accomplish this?

            GalenS




            Comment

            • Peter Huang [MSFT]

              #7
              Re: vb2005 propertybag

              Hi,

              From your description, I understand that you have a usercontrol.
              There is a panel on the usercontrol and a picturebox on the user control.
              And now you want to handle the mouse event from the user control.
              If I have any misunderstandin g, please let me know.

              Based on my research, the approach to handle the mouse event is same.
              Select the picturebox instance from the IDE code view left dropdownbox, and
              select the mouse event from the IDE code view right dropdownbox.

              BTW: Commonly for a new question, I suggest you open a new thread, so that
              the whole post will easier be read.

              Best regards,

              Peter Huang
              Microsoft Online Partner Support

              Get Secure! - www.microsoft.com/security
              This posting is provided "AS IS" with no warranties, and confers no rights.

              Comment

              Working...