What is this VB6 method doing?

Posted by Craig on Stack Overflow See other posts from Stack Overflow or by Craig
Published on 2012-10-30T04:59:13Z Indexed on 2012/10/30 4:59 UTC
Read the original article Hit count: 127

Filed under:
|

We are converting a VB6 application to C# (4.0). and have come across a method in VB6 that we're battling to understand.

Public Sub SaveToField(fldAttach As ADODB.Field)
    Dim bData() As Byte
    Dim nSize As Long

    nSize = Len(m_sEmail)
    bData = LngToByteArray(nSize)
    fldAttach.AppendChunk bData

    If nSize > 0 Then
        bData = StringToByteArray(m_sEmail)
        fldAttach.AppendChunk bData
    End If

    nSize = Len(m_sName)
    bData = LngToByteArray(nSize)
    fldAttach.AppendChunk bData
    If nSize > 0 Then
        bData = StringToByteArray(m_sName)
        fldAttach.AppendChunk bData
    End If

    bData = LngToByteArray(m_nContactID)
    fldAttach.AppendChunk bData

End Sub

It seems like it's doing some binary file copy type thing, but I'm not quite understanding. Could someone explain so that we can rewrite it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb6