vb2005 propertybag

  • Thread starter Thread starter Galen Somerville
  • Start date Start date
G

Galen Somerville

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
 
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
 
Homer J Simpson said:
Can't you use collections?


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
 
Galen Somerville said:
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

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
 
"Peter Huang" said:
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.
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
 
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.
 
Back
Top