|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
vb2005 propertybagMy 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 "Galen Somerville" <galen@community.nospam> wrote in message Can't you use collections?news:%23RwfHgMOGHA.2124@TK2MSFTNGP14.phx.gbl... > 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 Path.GetTempPath> file is explicitly named, in the samples, how do I keep the instances > separate?? My.Computer.FileSystem.GetTempFileName "Homer J Simpson" <nob***@nowhere.com> wrote in message news:vqtLf.3759$Cp4.1309@edtnps90...Show quoteHide quote > The following is typed in not copied in.> "Galen Somerville" <galen@community.nospam> wrote in message > news:%23RwfHgMOGHA.2124@TK2MSFTNGP14.phx.gbl... > >> 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. > > Can't you use collections? > >> 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?? > > Path.GetTempPath > > My.Computer.FileSystem.GetTempFileName > > in CtrlVol_Load If File.Exists("CtrlVol.bin") Then Dim MyFileStream as Stream = File.OpenRead("CtrlVol.bin") Dim deserializer As New BinaryFormatter() CtrlVol = CType(deserializer.Deserialize(MyFileStream), CtrlVol) MyFileStream,Close() 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
Show quote
Hide quote
"Galen Somerville" <galen@community.nospam> wrote in message As long as you don't delete the file it will persist and won't be reused. news:uzjxYeOOGHA.3888@TK2MSFTNGP10.phx.gbl... > > "Homer J Simpson" <nob***@nowhere.com> wrote in message > news:vqtLf.3759$Cp4.1309@edtnps90... >> >> "Galen Somerville" <galen@community.nospam> wrote in message >> news:%23RwfHgMOGHA.2124@TK2MSFTNGP14.phx.gbl... >> >>> 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. >> >> Can't you use collections? >> >>> 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?? >> >> Path.GetTempPath >> >> My.Computer.FileSystem.GetTempFileName >> >> > The following is typed in not copied in. > > in CtrlVol_Load > If File.Exists("CtrlVol.bin") Then > Dim MyFileStream as Stream = File.OpenRead("CtrlVol.bin") > Dim deserializer As New BinaryFormatter() > CtrlVol = CType(deserializer.Deserialize(MyFileStream), CtrlVol) > MyFileStream,Close() > 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 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 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.
Show quote
Hide quote
""Peter Huang" [MSFT]" <v-phu***@online.microsoft.com> wrote in message It turns out that I don't need a propertybag (serialization). When I leave news:18u4XXQOGHA.668@TK2MSFTNGXA01.phx.gbl... > 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. > 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 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 misunderstanding, 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. |
|||||||||||||||||||||||