cancel
Showing results for 
Search instead for 
Did you mean: 

Can't set CheckBox.Checked property to True

Former Member
0 Kudos

Hi,

I have a check box whose checked property I'm trying to set to true, but it just won't set. Even if I litterally say oCheck.Checked = True, it remains False. I'm using a user data source of short text with one character just as I do in a previous add-on. The previous add-on works but second one doesn't. In order to get the second add-on to work, I had to use the ValOn and ValOff properties. Would there be any reason for this? I'd like to understand what is going on.

Thanks,

Mike

View Entire Topic
Former Member
0 Kudos

Hello,

Use the Val ValOFf Property


        Dim oCheck As SAPbouiCOM.CheckBox = oForm.Items.Add("CHK", BoFormItemTypes.it_CHECK_BOX).Specific()
        oCheck.ValOn = "Y"
        oCheck.ValOff = "N"
        oCheck.Caption = "TEST"
        oForm.DataSources.UserDataSources.Add("CHKDS", BoDataType.dt_SHORT_TEXT, 1)
        oCheck.DataBind.SetBound(True, "", "CHKDS")
        oForm.DataSources.UserDataSources.Item("CHKDS").Value = "Y"

After you have binded to the datasource, you can check/unCheck by UserDataSource Value to set Y/N, or You can check/uncheck true code.

Regards,

János

Former Member
0 Kudos

Hi Janos,

What is the code for two grouped option buttons, when I want to set one as a default when the form opens? If I don't do this, neither one is set even though they are mutually exclusive.

Thanks,

Mike

Former Member
0 Kudos

Hello,

Based on the Forum rule please post your next question in a new Thread, and Close the Thread / give points when anwers...

By the way:

SDK HELP : C:Program FilesSAPSAP Business One SDKSamplesCOM UIVB.NET07.ComplexForm2003 Complexform example



 oForm.DataSources.UserDataSources.Add("OpBtnDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)

      For i = 1 To 3
            oItem = oForm.Items.Add("OpBtn" & i, SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON)
            oItem.Left = 20
            oItem.Width = 100
            oItem.Top = 30 + (i - 1) * 19
            oItem.Height = 19
            oItem.FromPane = 1
            oItem.ToPane = 1

            oOptionBtn = oItem.Specific
            oOptionBtn.Caption = "Option Button" & i

            If i > 1 Then
                oOptionBtn.GroupWith(("OpBtn" & i - 1))
            End If

            oOptionBtn.DataBind.SetBound(True, "", "OpBtnDS")
        Next i


oForm.DataSources.UserDataSources.Item("OpBtnDS").Value = 1 '1st is selected
oForm.DataSources.UserDataSources.Item("OpBtnDS").Value = 2 '2nd is selected
'...etc

There 3 Option Buttons are groupped together, and DataSource Value gives 1,2,3 if 1st, 2nd, 3rd selected.

Regards,

János