GetBinaryValue Example for Visual Basic
Private Sub TestProc1()
Dim lCount As Long
Dim x As Long
Dim nRet As Integer
Dim nLen As Integer
Dim byteVal As Byte
Dim szBytes As String
Dim szByte As String
LEADDICOM1.EnableMethodErrors = False
'move to the root element
LEADDICOM1.MoveFirstElement False
LEADDICOM1.MoveRootElement
Text1.Visible = True
Text1.Text = ""
'insert some bytes into the element
szBytes = "This is a Test 1234!"
nLen = Len(szBytes)
LEADDICOM1.BinaryValueCount = nLen
For x = 0 To nLen - 1
szByte = Mid$(szBytes, x + 1, 1)
byteVal = CByte(Asc(szByte))
LEADDICOM1.BinaryValues(x) = CInt(byteVal)
Next
'set the bytes
nRet = LEADDICOM1.SetBinaryValue(nLen)
If (nRet <> 0) Then
MsgBox "Error"
Exit Sub
End If
LEADDICOM1.BinaryValueCount = 0 'free the values
'get the byte count
lCount = LEADDICOM1.CurrentElement.Length
MsgBox "There are " & CStr(lCount) & " bytes!"
'get the bytes
nRet = LEADDICOM1.GetBinaryValue(lCount)
If (nRet = 0) Then
For x = 0 To LEADDICOM1.BinaryValueCount - 1
'display each byte as a char separated by a space
Text1.Text = Text1.Text & " " & Chr(LEADDICOM1.BinaryValues(x))
Next
End If
LEADDICOM1.EnableMethodErrors = True
msgbox "wait"
End Sub