on 02-17-2015 1:57 PM
Hi All,
I designed screen using Screen Painter. It has one Combobox Column.we can't add Combobox Value using Screen Painter.
So How to add Combobox value on it.
This is an easy way to do it.
objMatrix.Columns.Item("colName").ValidValues.Add("value", "desc")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lakshmi,
The field that you have bind with the ComboBox, should have the valid values. After that you will be able to use it as you want.
If you need code to do it. Follow it
private void FillValidValues()
{
SAPbobsCOM.Recordset oRecSet = default(SAPbobsCOM.Recordset);
SAPbouiCOM.ButtonCombo oCombo = default(SAPbouiCOM.ButtonCombo);
try
{
oCombo = (SAPbouiCOM.ButtonCombo)this.m_SBO_Form.Items.Item(enControlName.btnCombo).Specific;
oRecSet = (Recordset)this.SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
oRecSet.DoQuery("SELECT Name FROM [@CopyToValues] order by Code Asc");
if (oCombo.ValidValues.Count > 0)
{
for (int i = 0; i <= oCombo.ValidValues.Count; i++)
{
oCombo.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index);
}
}
oCombo.ValidValues.Add("", "");
if (oRecSet.RecordCount > 0)
{
while (oRecSet.EoF == false)
{
oCombo.ValidValues.Add(oRecSet.Fields.Item(0).Value.ToString().Trim(), "");
oRecSet.MoveNext();
}
}
}
catch (Exception ex)
{
this.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
Also if you need combobox in Grid, use it as follows:
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Select")));
oEditColumn.Type = BoGridColumnType.gct_CheckBox;
Hope it helps.
Thanks & Regards
Ankit Chauhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.