Click here to Skip to main content
15,881,248 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Preventing file access Pin
Dave Kreskowiak14-Jul-08 4:31
mveDave Kreskowiak14-Jul-08 4:31 
GeneralRe: Preventing file access Pin
im_hoser14-Jul-08 8:14
im_hoser14-Jul-08 8:14 
GeneralRe: Preventing file access Pin
Dave Kreskowiak14-Jul-08 15:09
mveDave Kreskowiak14-Jul-08 15:09 
QuestionText translation Pin
Agweet13-Jul-08 5:10
Agweet13-Jul-08 5:10 
JokeBuy some dictionaries. Pin
CPallini13-Jul-08 21:52
mveCPallini13-Jul-08 21:52 
AnswerRe: Text translation Pin
Steven J Jowett14-Jul-08 13:10
Steven J Jowett14-Jul-08 13:10 
GeneralRe: Text translation Pin
Agweet14-Jul-08 20:18
Agweet14-Jul-08 20:18 
QuestionSystem.Drawing.Region Serialize/Deserialize Pin
lobotomizzato13-Jul-08 5:02
lobotomizzato13-Jul-08 5:02 
I have a class with a Region property, that I need to serialize/deserialize (using BinaryFormatter)

My class implements ISerializable and uses a second property to do the job
My code so far:

Private Property MyRegionData() As Byte()
    Get
        Return Me.MyRegion.GetRegionData.Data
    End Get
    Set(ByVal value As Byte())
        Dim reg As New Region
        Dim data As Drawing2D.RegionData = reg.GetRegionData
        data.Data = value
        m_MyRegion = New Region(data)
        reg.Dispose()
    End Set
End Property

Private m_MyRegion As Region = Nothing
Public Property MyRegion() As Region
    Get
        Return m_MyRegion
    End Get
    Set(ByVal value As Region)
        If m_MyRegion IsNot Nothing Then
            m_MyRegion.Dispose()
        End If
        m_MyRegion = value
    End Set
End Property

Public Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements ISerializable.GetObjectData
    info.AddValue("MyRegion", Me.MyRegionData, GetType(Byte()))
End Sub

Public Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
    MyBase.New()
    Me.MyRegionData = DirectCast(info.GetValue("MyRegion", GetType(Byte())), Byte())
End Sub


This code works, but i worder if there is a better way to deserialize it.
Region does have a constructor that takes a RegionData, but RegionData doesn't have any public constructor (that's why i use a second region object to get a RegionData).

Thanks for your help
Questionhelp please Pin
zero_angel12-Jul-08 14:36
zero_angel12-Jul-08 14:36 
AnswerRe: help please Pin
Paul Conrad13-Jul-08 7:31
professionalPaul Conrad13-Jul-08 7:31 
AnswerRe: help please Pin
Vimalsoft(Pty) Ltd14-Jul-08 5:09
professionalVimalsoft(Pty) Ltd14-Jul-08 5:09 
QuestionSystem.Management.ManagementObject decleratoin error ? Pin
kindman_nb12-Jul-08 4:20
kindman_nb12-Jul-08 4:20 
AnswerRe: System.Management.ManagementObject decleratoin error ? Pin
Luc Pattyn12-Jul-08 4:36
sitebuilderLuc Pattyn12-Jul-08 4:36 
GeneralRe: System.Management.ManagementObject decleratoin error ? Pin
kindman_nb12-Jul-08 5:14
kindman_nb12-Jul-08 5:14 
QuestionAlgo... Pin
stepdeb12-Jul-08 2:32
stepdeb12-Jul-08 2:32 
AnswerRe: Algo... Pin
Luc Pattyn12-Jul-08 3:27
sitebuilderLuc Pattyn12-Jul-08 3:27 
QuestionHow to adjust Datagrid row height Pin
Mohammad Al Hoss12-Jul-08 1:22
Mohammad Al Hoss12-Jul-08 1:22 
AnswerRe: How to adjust Datagrid row height Pin
Vimalsoft(Pty) Ltd12-Jul-08 11:23
professionalVimalsoft(Pty) Ltd12-Jul-08 11:23 
QuestionRe: how to chat the two system,but there is located in different location Pin
Pandian60212-Jul-08 0:12
Pandian60212-Jul-08 0:12 
QuestionRe: how to chat the two system,but there is located in different location Pin
csciwizard12-Jul-08 9:40
csciwizard12-Jul-08 9:40 
AnswerRe: how to chat the two system,but there is located in different location Pin
Paul Conrad12-Jul-08 10:06
professionalPaul Conrad12-Jul-08 10:06 
Questionmy form doesnot work properly Pin
en.Mahdi11-Jul-08 22:26
en.Mahdi11-Jul-08 22:26 
AnswerRe: my form doesnot work properly Pin
Vimalsoft(Pty) Ltd12-Jul-08 11:24
professionalVimalsoft(Pty) Ltd12-Jul-08 11:24 
GeneralRe: my form doesnot work properly Pin
en.Mahdi12-Jul-08 18:29
en.Mahdi12-Jul-08 18:29 
GeneralRe: my form doesnot work properly Pin
Vimalsoft(Pty) Ltd13-Jul-08 15:08
professionalVimalsoft(Pty) Ltd13-Jul-08 15:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.