I need to display the item that get it from database into the listview form.Attached is my code and when go
to itmListItem.SubItems(2) = CommentCode i got error message invalid property value..Kindly help..I had specify the number of columnheaders in lisview property.
Kindly help...
Expand|Select|Wrap|Line Numbers
- Private Function GetHoldInfo()
- 8 Dim oSQL As New clsSQL
- 9 Dim sMsg As String
- 10 Dim cRow As FwAttributes
- 12 'Form the body SQL statement to get the LotId from the cim_multiple_hold table where the
- 13 'Lot status is Hold
- 15 sMsg = "select comment_code, descr,lot_id "
- 16 sMsg = sMsg & "from "
- 17 sMsg = sMsg & "cim_tbl_multiplehold "
- 18 sMsg = sMsg & "where "
- 19 sMsg = sMsg & "lot_id = '" & rc.Lot.Id & "' "
- oSQL.Server = "CATdefault"
- oSQL.UpdateMode = False
- 22 oSQL.SqlCall = sMsg
- 24 If oSQL.SqlResult.Count = 0 Then
- 25 LSIMsgBox "This Lot id hold info not found in the database."
- 26 Else
- 27 For Each cRow In oSQL.SqlResult
- 28 AddListViewEntry cRow("lot_id"), cRow("comment_code")
- 29 Next
- 30 End If
- 32 Set oSQL = Nothing
- 34 '*** START FAILSAFE ********************************************************************************************************************************
- 35 FailSafe_Exit:
- 36 Trace "Exit", 9
- 37 Pop
- 38 Exit Function
- 39 FailSafe_Error:
- 40 ' *** Insert Special Error Handling Here ***
- 41 LogError
- 42 Resume FailSafe_Exit 'default is to exit this procedure
- 43 '*** STOP FAILSAFE ***
- End Function
Expand|Select|Wrap|Line Numbers
- Private Sub AddListViewEntry(ByVal LotId As String, ByVal CommentCode As String)
- 1 '*** START FAILSAFE ***
- 2 On Error GoTo FailSafe_Error 'setup error handler
- 3 Push "frmComment_multiplehold", "Sub AddListViewEntry", "()"
- 4 Trace "Enter", 9
- 5 '*** STOP FAILSAFE ********************************************************************************************************************************
- 7 'Create a variable to add ListItem objects.
- 8 Dim itmListItem As ListItem
- 11 'Initializes a ListView Object for adding items to the list
- 12 Set itmListItem = ListView1.ListItems.Add()
- 14 '1st Column
- 15 itmListItem.SubItems(1) = LotId
- 17 '2nd Column
- 18 itmListItem.SubItems(2) = CommentCode
- 23 '*** START FAILSAFE ********************************************************************************************************************************
- 24 FailSafe_Exit:
- 25 Trace "Exit", 9
- 26 Pop
- 27 Exit Sub
- 28 FailSafe_Error:
- 29 ' *** Insert Special Error Handling Here ***
- 30 LogError
- 31 Resume FailSafe_Exit 'default is to exit this procedure
- 32 '*** STOP FAILSAFE ***
- End Sub