Creating a new document in vb.net using DM 5.1.05 API results in zero length file

Using the example from the API reference and modifying it for vb.net from vb6, i am creating a new document in DM. The result is that no error is thrown, the document does get created but the version of the document in DM is 0 length. Trapping the "TotalBytesWritten" return value also reveals that no bytes were written. The errDescription and errNumber both are OK.

Here is my VB.Net code

Dim DocNumber As Long
Dim VersionID As Long
Dim TotalFileSize As Long
Dim TotalBytesWritten As Long
Dim szErr As String
Dim bdata() As Byte
Dim objDoc As New PCDCLIENTLib.PCDDocObject
objDoc.SetProperty("%TARGET_LIBRARY", gszLibrary)
objDoc.SetDST(gszDst)
'Set the Profile Form for this document.
**code that sets the profile field values purposely omitted from ee post ***

The code example from the api reference used the OPEN and GET methods.
Here is the crux of the writing portion from the example:

Dim DocNumber As Long
Dim VersionID As Long
Dim TotalFileSize As Long
Dim TotalBytesWritten As Long
Dim Buffread As Long
'Set bdata ridiculously low for test purposes
'to increase the likelihood of corruption.
Dim bdata(16) As Byte
Dim objDoc As PCDDocObject
Set objDoc = New PCDDocObject
objDoc.SetProperty "%TARGET_LIBRARY", Library
objDoc.SetDST DST
'Set the Profile Form for this document.
***PROFILE FIELD VALUES OMITTED FOR EE POST***
Dim objPutDoc As PCDPutDoc
Set objPutDoc = CreateObject( _
"PCDClient.PCDPutDoc")
objPutDoc.SetDST DST