Using databinding checkbow control

Using databinding checkbow control

Postby Jayel » Sun 21 Jan 2007 14:44


I am using vb2005 and the mysqldirect 3.55.18.
Is there a way to do a databinding with a checkbox?

Code: Select all
        Call OpenConnection()
        privAdapter = New MySqlDataAdapter("Select * from tbldevices", privdb)
        'privAdapter.SelectCommand = privSelectCommand
        'privAdapter.InsertCommand = privInsertCommand
        ' privAdapter.UpdateCommand = privUpdateCommand
        privDataSet = New DataSet()

        privAdapter.Fill(privDataSet, "devices")
        cmClient = Me.BindingContext(privDataSet.Tables("devices"))
        cmClient.Position = 0
        Call FillCombobox()
        cmbSoort.DataBindings.Add("selectedvalue", privDataSet.Tables("devices"), "soortid")
        txtDeviceId.DataBindings.Add("text", privDataSet.Tables("devices"), "deviceid")
        CheckGebruikt.DataBindings.Add("checked", privDataSet.Tables("devices"), "gebruikt")
        txtOmschrijving.DataBindings.Add("text", privDataSet.Tables("devices"), "omschrijving")

The checkbox control "Checkgebruikt" doesn't bind !!
Is there a way to do this?

Posts: 8
Joined: Wed 27 Dec 2006 17:15

Postby Alexey » Mon 22 Jan 2007 07:40

Try to use MySqlDataTable component to bind checkbox, e.g.:
Code: Select all
MySqlDataTable1 = New MySqlDataAdapter("Select * from tbldevices", privdb)
CheckGebruikt.DataBindings.Add("Checked", MySqlDataTable1, "gebruikt")

For more information about data binding please take a look at Web Forms Data Binding or Windows Forms Data Binding.
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Return to dotConnect for MySQL