cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox won't stay checked

Former Member
0 Kudos

Hi,

I added a checkbox to a form with the code below:

oItem = oForm.Items.Add("cbGroup", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX)

oItem.Top = 355

oItem.Left = 25

Dim loCheckBox As SAPbouiCOM.CheckBox

loCheckBox = oItem.Specific

loCheckBox.Checked = True

loCheckBox.Caption = "Group"

The checkbox appears fine on my form, I even can execute code when the click event is triggert.

The problem is dat the checkbox never stays check when I want to, it always stays false.

Anyone has a solution?

regards,

Bas Dekker

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Adele,

Thank you for your example, this solved my problem!

I looked into the help which comes with the SDK, but didn't read there I had to bind it.

Thnaks a lot again.

regards,

Bas Dekker

Former Member
0 Kudos

Hi Bas,

You're welcome. If I have solved your problem please award points.

Thanks,

Adele

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Bas,

In order for a check box to stay checked you have to bind it to a data source. This data source could be a user data source or a DB data source. Let's say you want to bind it to a user data source you could add the code below to your code:

oForm.DataSources.UserDataSources.Add("udGroup", dt_SHORT_TEXT, 1)

loCheckBox.ValOn = "Y"

loCheckBox.ValOff = "N"

loCheckBox.DataBind.SetBound(True, "", "udGroup")

Hope it helps,

Adele