Kris

Kris

  • NA
  • 2
  • 0

disable 1 of 3 checkboxstates and question about mouse event

Apr 5 2006 10:53 AM
i've filled a datagrid with the help of a selfmade datatable. one column has the datatype of boolean, and shows a checkbox. now when i click the checkbox there also is the state which checks the box but is grey. how can i work this away, cause it gives errors.

Also when i click in the datagrid it has to check if there is a checkbox checked. depending on that checkbox, a value in a textbox has to change. this works, but i have to click in another cell before it does it.

can someone help me

Dim bestellingsid As DataColumn = New DataColumn
        Dim detailid As DataColumn = New DataColumn
        Dim artikel As DataColumn = New DataColumn
        Dim prijs As DataColumn = New DataColumn
        Dim weg As DataColumn = New DataColumn
        weg.DataType = System.Type.GetType("System.Boolean")
        weg.DefaultValue = False
        bestellingsid.ColumnName = "bestellingsid"
        detailid.ColumnName = "detailid"
        artikel.ColumnName = "artikel"
        prijs.ColumnName = "prijs"
        weg.ColumnName = "weg"
        dtBoek.Columns.Add(bestellingsid)
        dtBoek.Columns.Add(detailid)
        dtBoek.Columns.Add(artikel)
        dtBoek.Columns.Add(prijs)
        dtBoek.Columns.Add(weg)
        dsOverboek.Tables.Add(dtBoek)


Private Sub dgboeken_mouseup(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgBoeken.MouseUp
        Try
            Dim zwart As Double = 0
            For i As Integer = 1 To Me.BindingContext(dsOverboek, "Boeken").Count
                If dsOverboek.Tables("Boeken").Rows(i - 1).Item(4) = True Then
                    'MessageBox.Show(dsOverboek.Tables("Boeken").Rows(i - 1).Item(1))
                    zwart = zwart + dsOverboek.Tables("Boeken").Rows(i - 1).Item(3)
                End If
            Next
            txtZwart.Text = zwart
        txtWit.Text = FormatNumber(totaal, 1) - FormatNumber(zwart, 1)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub