本文介绍了绑定复选框默认状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

目前,我很困惑地设置数据绑定复选框控件的checkedstate或新记录的checked属性.以下所有内容均无法达到我的预期.有任何想法吗?列活动"指的是活动".是TinyInt(1),我需要在默认情况下将其默认设置为1(true) 添加新记录.我尝试从绑定导航器处理它,并添加了新方法,但没有结果.

I am currently stumped on setting a databound checkbox control checkedstate, or checked property on new records. None of the below will work as I would expect. Any ideas? The column "Active" is TinyInt(1) and I need it to default to 1 (true) upon adding new records. I've tried handeling it from the binding navigator adding new method as well with the same nonresult.

    Private Sub AddNewPart() Handles PartsBS.AddingNew
        chk_active.Checked = True
        chk_active.CheckState = CheckState.Checked
        PartsBS.Current("Active") = True
    End Sub

生活就好像你今天要死一样,学习就好像你要永远生活一样-甘地·甘地(Mahatma Gandhi)

Live as if you were going to die today, learn as if you were going to live forever -Mahatma Gandhi

推荐答案

                With PartsTable
                    .Columns("Active").DefaultValue = "1"
                End With
                PartsBS.DataSource = PartsTable

此时,复选框数据绑定将处理checkedstate和checked属性.

At which point the checkbox databindingbinding handles the checkedstate and checked properties.


这篇关于绑定复选框默认状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:57