📚 SAP Business One SDK Help

Add Method
See Also  Example
UID

The unique ID of the item; maximum 10 characters.

  • 1  is reserved for the Add button and includes automatic management of form mode by the application (changing the button caption when the form mode changes).
  • 2 is reserved for the Cancel button.
Type
The type of item to add

Description

Adds an item to the collection.

In version 2004, the DataBrowser object was added to support activating the application navigation icons  for your form. The browsing sequence is automatically inherited from the database record.

The UI API will continue to support activating navigation icons via Form.EnableMenu for backward compatibility.

Syntax

Visual Basic
Public Function Add( _
   ByVal UID As String, _
   ByVal Type As BoFormItemTypes _
) As Item

Parameters

UID

The unique ID of the item; maximum 10 characters.

  • 1  is reserved for the Add button and includes automatic management of form mode by the application (changing the button caption when the form mode changes).
  • 2 is reserved for the Cancel button.
Type
ValueDescription
it_BUTTONButton (not relevant for column type)
it_STATICStaticText  (not relevant for column type)
it_EDITEditText
it_FOLDERFolder (not relevant for column type)
it_RECTANGLEFrame (not relevant for column type)
it_COMBO_BOXComboBox
it_LINKED_BUTTONLinkedButton
it_PICTUREPictureBox
it_EXTEDITEditText with multiple lines
it_CHECK_BOXCheckBox
it_OPTION_BUTTONOptionBtn  (not relevant for column type)
it_MATRIXMatrix  (not relevant for column type)
it_GRIDGrid
it_PANE_COMBO_BOXPaneComboBox (not relevant for column type)
it_ACTIVE_XActiveX
it_BUTTON_COMBOButtonCombo (not relevant for column type)
it_WEB_BROWSERWebBrowser
The type of item to add

Remarks

An item UID is limited to 10 characters and must be unique per form.

Note that when adding new elements to a form, by default, the elements are positioned to the left-hand side of the first element. To position the elements correctly, set real values to the Left and Top properties.

Example

The following sample code shows how to add items to a form.
(Visual Basic)Copy Code
Public Sub AddItemToForm()
    Dim oForm As SAPbouiCOM.Form

    Dim oItem As SAPbouiCOM.Item

    '// add a new form
    Set oForm = SBO_Application.Forms.Add("MatrixForm")

    '// Adding a Button item
    Set oItem = oForm.Items.Add("Button1", it_BUTTON)
End Sub
The following sample code shows how to activate navigation icons.
Activating Navigation Icons (Visual Basic)Copy Code
oItem = oForm.Items.Add("BrsBtn", SAPbouiCOM.BoFormItemTypes.it_BROWSE_BUTTON)
New form item Type
oItem.LinkTo = "NameEdit1" '// link it to the field that sets the browsing sequence

See Also