Private Sub lstSkills_Click()

     ' This subroutine sets the fields displayed to the details of the 
    ' list's currently selected skill    
 
    Dim iRet As Integer
    Dim sBuff As String
    Dim lFlags As Long
    Dim lDataLen As Long
 
    If (lstSkills.ListIndex > -1) Then ' selected
        ' Read record 
        ' set key 
        iRet = LceSetFieldValue(iSession, "SKILCODE", _
               SkillKey(lstSkills.ListIndex))
        ' fetch record
        iRet = LceFetch(iSession, "SKILCODE,SKILDESC", "SKLTAB", _ 
               "SKILCODE") ' Get Record
 
        ' get data and set fields 
        ' get code
        iRet = LceGetFieldDataLength(iSession, "SKILCODE", lDataLen)
        sBuff = String(lDataLen + 1, Chr(0)) 
        iRet = LceGetFieldValueX(iSession, "SKILCODE", sBuff, lFlags) ' Get Field
        If lFlags = 1 Then
           txtCode.Text = "Null value"
        Else
           txtCode.Text = sTrim(sBuff)
        EndIf
        ' get description
        sBuff = String(RDMLX_FIELD_DATA_SIZE + 1, Chr(0)) 
        iRet = LceGetFieldValueX(iSession, "SKILDESC", sBuff, lFlags)
        If lFlags = 1 Then
           txtDesc.Text = "Null value"
        Else
           txtDesc.Text = sTrim(sBuff)
        EndIf
    End If
End Sub