Results 1 to 4 of 4

Thread: Problem With Listview And Checkbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    66

    Problem With Listview And Checkbox

    can u guys help me with this code?
    VB Code:
    1. Dim itm As ListItem
    2.                     For Each itm In lvList.ListItems
    3.                         If itm.Checked Then
    4.                               rs.Index = "JobNumber"
    5.                               rs.Seek "=", lvList.SelectedItem.ListSubItems(1)
    6.                                   If Not rs.NoMatch Then
    7.                                       Call UpdateReport
    8.                                       MsgBox lvList.SelectedItem.ListSubItems(1).Text
    9.                                   Else
    10.                                       MsgBox "ERROR", vbCritical, "ERROR"
    11.                                   End If
    12.                         Else
    13.                         End If
    14.                     Next itm


    it does not work. can u help me gusys with this? thanks!



    -

  2. #2
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem With Listview And Checkbox

    What is the error?

  3. #3
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Problem With Listview And Checkbox

    Is JobNumber the primarykey of the table? If not then use Find method instead, in criteria specify fieldname for match in the same manner you would create a criteria in an SQL WHERE clause.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Problem With Listview And Checkbox

    Try this
    VB Code:
    1. Dim itm As ListItem
    2. Dim i As Long
    3.  
    4.   For i = 1 To lvList.ListItems.Count
    5.       If lvList.ListItems.Item(i).Checked = True                        
    6.          rs.Index = "JobNumber"
    7.          rs.Seek "=", lvList.SelectedItem.ListSubItems(1)
    8.               If Not rs.NoMatch Then
    9.                  Call UpdateReport
    10.                  MsgBox lvList.SelectedItem.ListSubItems(1).Text
    11.               Else
    12.                  MsgBox "ERROR", vbCritical, "ERROR"
    13.               End If
    14.       'Else
    15.       'if you are not going to do anything with the Else
    16.       'then you dont need it
    17.       End If
    18.   Next itm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width