cancel
Showing results for 
Search instead for 
Did you mean: 

error can't Click button when add value to ComboBox

Former Member
0 Kudos

How can I do ? who know programming C# ? help me !

ComboBox displayed value but I can't Click " Exit Button " (btnExit) and Click "Cal button"(btnCal)

IF I Remove this code

"

if ((pVal.ItemUID == "CbIncen") && (pVal.Before_Action == true))// && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS))

{

.............

}

or

remove * oComBox.ValidValues.Add(value2, value1); *

" then OK no error and I can Click Exit Button and Click Cal button


 private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
 {
            BubbleEvent = true;
             if((pVal.FormUID=="CalculateForm"))
            { 
              if ((pVal.ItemUID == "btnCal") && (pVal.Before_Action == false) && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED))
                {
                   // return  value when click  "btnCal" button
                  SBO_Application.MessageBox("You click button", 1, "OK", "", "");
                            
                }

               if ((pVal.ItemUID == "btnExit") && (pVal.Before_Action == false) && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED))
                {
                   // return  value when click  "btnCal" button
                  SBO_Application.MessageBox("You click Exit", 1, "OK", "", "");
                  oForm = SBO_Application.Forms.Item(pVal.FormUID);
                  oForm.Close();           
                }

                if ((pVal.ItemUID == "CbIncen") && (pVal.Before_Action == true))// && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS))
                {
                    SBO_Application.MessageBox("click" + Convert.ToString(pVal.Before_Action), 1, "OK", "", "");
                   // BubbleEvent = true;
                    SAPbouiCOM.Form oForm1;
                    SAPbouiCOM.Item oItem1;
                    SAPbouiCOM.ComboBox oComBox;
                    SAPbobsCOM.Recordset oRecordSet;

                    oForm1 = SBO_Application.Forms.Item(pVal.FormUID);
                    ////tra lai gia tri tu combo va dua vao textbox

                    oItem1 = oForm1.Items.Item("CbIncen");
                    oComBox = ((SAPbouiCOM.ComboBox)(oItem1.Specific));


                    //cai nay co nhuoc diem la ban ko the update lien tuc
                    oRecordSet = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
                    string sSQL = "select IncentiveID,IncentiveName from dbo.[T_Incentive]";

                    while (oComBox.ValidValues.Count > 0)
                    {
                        oComBox.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                    }
                    oForm1.Items.Item("CbIncen").Refresh();
                    //truong khi add vao comboBox ban phai remove combox

                    oRecordSet.DoQuery(sSQL);
                    string value1 ="";
                    string value2 ="";
                    if (oRecordSet.RecordCount > 0)
                    {
                        while (!(oRecordSet.EoF == true))
                        {
                            value1 = Convert.ToString(oRecordSet.Fields.Item("IncentiveID").Value);
                            value2 = Convert.ToString(oRecordSet.Fields.Item("IncentiveName").Value);
                            oComBox.ValidValues.Add(value2, value1);  // *ComboBox displayed value but I can't Click " Exit Button " (btnExit) and Click "Cal button"(btnCal)* 
                            oRecordSet.MoveNext();
                        }
                    }
                    //BubbleEvent = true;
                }

            }


thanks you !

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi fithou,

Please post half of your text on a reply under the same post. And put your code between tags.

Regards,

Vítor Vieira