GetAgeValue Example for Visual Basic
Private Sub TestProc8()
Dim lCount 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 Age Value
LEADDICOM1.InsertElement False, TAG_PATIENT_AGE, VR_AS, False, 0
'insert an Age value into the element
LEADDICOM1.AgeValueCount = 1
LEADDICOM1.AgeValues (0).Number = 21
LEADDICOM1.AgeValues (0).Reference = CInt(Asc("Y"))
'set the age
nRet = LEADDICOM1.SetAgeValue(1)
If (nRet <> 0) Then
MsgBox "Error"
Exit Sub
End If
LEADDICOM1.AgeValueCount = 0 'free the value
'get the value count
lCount = LEADDICOM1.GetValueCount
MsgBox "There are " & CStr(lCount) & " values!"
'get the value
nRet = LEADDICOM1.GetAgeValue (0, lCount)
'display the value
Text1.Text = "Number: " & CStr(LEADDICOM1.AgeValues (0).Number) & "Ref: " & Chr(LEADDICOM1.AgeValues (0).Reference)
LEADDICOM1.EnableMethodErrors = True
MsgBox "wait"
End Sub