Reputation: 1936
I am using SAP B1 Studio to make an 2 edittexts with choose from lists for CardCode and CardName. I keep getting the error 'Error: 'Item - Can't set value on item because the item can't get focus. [66000-153]' after I make a selection from any of the 2.
What could be wrong?
Here is the code I am using:
this.txtCCode = ((SAPbouiCOM.EditText)(this.GetItem("txtCCode").Specific));
txtCCode.ChooseFromListAfter += txtCCode_ChooseFromListAfter;
this.txtCName = ((SAPbouiCOM.EditText)(this.GetItem("txtCName").Specific));
txtCName.ChooseFromListAfter += txtCName_ChooseFromListAfter;
private void txtCCode_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
{
try
{
SAPbouiCOM.ISBOChooseFromListEventArg oCFLEvento = (SAPbouiCOM.ISBOChooseFromListEventArg)(pVal);
string sCFL_ID = oCFLEvento.ChooseFromListUID;
SAPbouiCOM.DataTable dt = oCFLEvento.SelectedObjects;
txtCName.Value = dt.GetValue("CardName", 0).ToString();
txtCCode.Value = dt.GetValue("CardCode", 0).ToString();
}
catch (Exception ex)
{
Application.SBO_Application.SetStatusBarMessage("Error: '" + ex.Message + "'", SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
private void txtCName_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
{
try
{
SAPbouiCOM.ISBOChooseFromListEventArg oCFLEvento = (SAPbouiCOM.ISBOChooseFromListEventArg)(pVal);
string sCFL_ID = oCFLEvento.ChooseFromListUID;
SAPbouiCOM.DataTable dt = oCFLEvento.SelectedObjects;
txtCCode.Value = dt.GetValue("CardCode", 0).ToString();
txtCName.Value = dt.GetValue("CardName", 0).ToString();
}
catch (Exception ex)
{
Application.SBO_Application.SetStatusBarMessage("Error: '" + ex.Message + "'", SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
Upvotes: 1
Views: 3195
Reputation: 646
if everything is properly bound to the editText and the ChooseFromList is configured, i would try removing the below from your first method:
txtCCode.Value = dt.GetValue("CardCode", 0).ToString();
as it should automatically fill in.
some other possibles:
try setting string instead of value
txtCCode.String =
try setting another item to active before setting value
myOtherControl.Active = True
Try Setting the value in the dbDatasource:
Dim oDBDataSource As SAPbouiCOM.DBDataSource = form.DataSources.DBDataSources.Item("OCRD")
oDBDataSource.SetValue("CardCode", 0, dt.GetValue("CardCode", 0))
Upvotes: 1