Results 1 to 2 of 2

Thread: checkboxlist - 2 Part Question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    checkboxlist - 2 Part Question

    I have a listbox populated with Users and a checkboxlist that is filled with report numbers.

    Once a person clicks on a User i'm wanting the corresponding reports to be checked in the checkboxlist.

    i know how to fill the checkboxlist but i dont know how to check the boxes once a user is selected.

    Code:
            OpenDataSet(dsBound, "SELECT BlockerNum FROM tblSQLReports ORDER BY BlockerNum ASC", "tblSQLReports")
            chkFields.DataSource = dsBound.Tables("tblSQLReports")
            chkFields.DataTextField = "BlockerNum"
            chkFields.DataValueField = "BlockerNumID"
            chkFields.DataBind()

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    Re: checkboxlist - 2 Part Question [Resolved]

    i got it...

    Code:
        Private Sub lstUsers2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstUsers2.SelectedIndexChanged
            Dim strSQL As String
            Dim x As Integer
            ' fill report list
    
            strSQL = "SELECT BlockerNum FROM tblSQLReports where userid='" & lstUsers2.SelectedValue & "' ORDER BY BlockerNum ASC"
            dsData.Clear()
            OpenDataSet(dsData, strSQL, "tblSQLReports")
            x = 0
            Dim i As Integer
            Try
    starthere:
                For i = 0 To chkFields.Items.Count - 1
                    If chkFields.Items(i).Text = dsData.Tables("tblSQLReports").Rows(x).Item("BlockerNum") Then
                        'if current checkbox contains value, select the box
                        chkFields.Items(i).Selected = True
                    End If
                Next
    
                x = x + 1
                GoTo starthere
            Catch ex As Exception
    
            End Try
    
        End Sub

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