Page 1 of 1

Using databinding checkbow control

Posted: Sun 21 Jan 2007 14:44
by Jayel
Hello,

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?

greets
John

Posted: Mon 22 Jan 2007 07:40
by Alexey
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.