DatagridView checkbox error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benniit
    New Member
    • May 2008
    • 54

    DatagridView checkbox error

    Am using vb.net 2008 and sql2008 and I want to loop thru frmMovement.Dat aGridView1 and the checked rows shd get populated into frmMovementRece ivedFiles.DataG ridView2. But I used Cbool, Boolean.TryPars e to convert the the checked value but I still get but still the error: "Conversion from string "" to type 'Boolean' is not valid"
    The code is as follows. Or ss there anyway to loop thru the checkboxes and populate them in another DatagridView2?

    Code:
     Dim ctr As Integer
            frmMovementReceivedFiles.DataGridView2.Rows.Clear()
            For ctr = 0 To frmMovement.DataGridView1.Rows.Count - 1
                If frmMovement.DataGridView1.Rows(ctr).Cells("Column1").Value = True Then
                    frmMovementReceivedFiles.DataGridView2.Rows.Add( _
                   frmMovement.DataGridView1.Rows(ctr).Cells(1).Value, _
                    frmMovement.DataGridView1.Rows(ctr).Cells(2).Value, _
                    frmMovement.DataGridView1.Rows(ctr).Cells(3).Value, _
                    frmMovement.DataGridView1.Rows(ctr).Cells(4).Value)
                End If
            Next
            If frmMovementReceivedFiles.DataGridView2.RowCount > 0 Then
                frmMovementReceivedFiles.Show()
            End If
    Last edited by tlhintoq; Mar 1 '10, 04:26 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      error: "Conversion from string "" to type 'Boolean' is not valid"
      If frmMovement.Dat aGridView1.Rows (ctr).Cells("Co lumn1").Value = True

      Are you sure this value isn't a string? I would put a breakpoint here and double check what the actual value is

      Comment

      Working...