Reputation: 83
namespace BordroPlus
{
[FormAttribute("BordroPlus.Puantaj", "Puantaj.b1f")]
class Puantaj : UserFormBase
{
SAPbouiCOM.Form oForm;
.....
CheckBox4.ValOn = "Y";
CheckBox4.ValOff = "N";
oForm.DataSources.UserDataSources.Add("UD_4", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
CheckBox4.DataBind.SetBound(true, "", "UD_4");
// this sets the checkbox to checked
oForm.DataSources.UserDataSources.Item("UD_4").Value = "Y"; `I have created an user form and tabcontrol in the form. Then i create a check box in the tab.
How can i start the checkbox as checked?
Thats my code. I am using C# in Visual Studio.
Upvotes: 1
Views: 6118
Reputation: 1314
Regarding Teta's answer,you would initialize ValOn and ValOff like this:
CheckBox0.ValOn = "Y";
CheckBox0.ValOff = "N";
You also need to setup a DataSource for the Checkbox for it to work properly:
oForm.DataSources.UserDataSources.Add("CheckboxDS", BoDataType.dt_SHORT_TEXT, 1);
CheckBox0.DataBind.SetBound(True, "", "CheckboxDS");
// this sets the checkbox to checked
oForm.DataSources.UserDataSources.Item("CheckboxDS").Value = "Y";
Upvotes: 2