GetStringValue Example for Visual Basic
Private Sub TestProc7()
Dim lCount As Long
Dim x As Long
Dim nRet As Integer
LEADDICOM1.EnableMethodErrors = False
'move to the root element
LEADDICOM1.MoveFirstElement False
LEADDICOM1.MoveRootElement
'insert a new element for the String Values
LEADDICOM1.InsertElement False, TAG_IMAGE_TYPE, VR_CS, False, 0
'insert some string values into the element
LEADDICOM1.StringValueCount = 5
For x = 0 To 5 - 1
LEADDICOM1.StringValues(x) = "String #" & CStr(x + 1)
Next
'set the strings
nRet = LEADDICOM1.SetStringValue(5)
If (nRet <> 0) Then
MsgBox "Error"
Exit Sub
End If
LEADDICOM1.StringValueCount = 0 'free the values
Text5.Visible = True
Text5.Text = ""
'get the value count
lCount = LEADDICOM1.GetValueCount
MsgBox "There are " & CStr(lCount) & " values!"
'get the values
nRet = LEADDICOM1.GetStringValue(0, lCount)
If (nRet = 0) Then
For x = 0 To LEADDICOM1.StringValueCount - 1
'display each value separated on a separate line
Text5.Text = Text5.Text & Chr(13) & Chr(10) & CStr(LEADDICOM1.StringValues(x))
Next
End If
LEADDICOM1.EnableMethodErrors = True
MsgBox "wait"
End Sub