on ‎2006 Feb 24 10:43 AM
How to create Forms or Layout for SAP Business One using object of the VB.net or exists some program specifies to create layout or Forms for SAP B1?
I want to pass a program in VB.Net for SAP B1, in consoles takes much time because to program, it is had that to program the properties of the object all
Request clarification before answering.
Hi
Try this..
Private Sub CreateForm()
Dim oItem As SAPbouiCOM.Item
'// *******************************************
'// we will use the following objects to set
'// the specific values of every item
'// we add.
'// this is the best way to do so
'//*********************************************
Dim oButton As SAPbouiCOM.Button
Dim oStaticText As SAPbouiCOM.StaticText
Dim oEditText As SAPbouiCOM.EditText
Dim oComboBox As SAPbouiCOM.ComboBox
'// add a new form
Dim oCreationParams As SAPbouiCOM.FormCreationParams
oCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
oCreationParams.UniqueID = "MySimpleForm"
oForm = SBO_Application.Forms.AddEx(oCreationParams)
'// add a User Data Source to the form
oForm.DataSources.UserDataSources.Add("EditSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
oForm.DataSources.UserDataSources.Add("CombSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
'// set the form properties
oForm.Title = "Simple Form"
oForm.Left = 400
oForm.Top = 100
oForm.ClientHeight = 80
oForm.ClientWidth = 350
'//*****************************************
'// Adding Items to the form
'// and setting their properties
'//*****************************************
'/**********************
'// Adding an Ok button
'//*********************
'// We get automatic event handling for
'// the Ok and Cancel Buttons by setting
'// their UIDs to 1 and 2 respectively
oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 6
oItem.Width = 65
oItem.Top = 51
oItem.Height = 19
oButton = oItem.Specific
oButton.Caption = "Ok"
'//************************
'// Adding a Cancel button
'//***********************
oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 75
oItem.Width = 65
oItem.Top = 51
oItem.Height = 19
oButton = oItem.Specific
oButton.Caption = "Cancel"
''//************************
''// Adding a Rectangle
''//***********************
oItem = oForm.Items.Add("Rect1", SAPbouiCOM.BoFormItemTypes.it_RECTANGLE)
oItem.Left = 0
oItem.Width = 344
oItem.Top = 1
oItem.Height = 49
'//***************************
'// Adding a Static Text item
'//***************************
oItem = oForm.Items.Add("StaticTxt1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 7
oItem.Width = 148
oItem.Top = 8
oItem.Height = 14
oItem.LinkTo = "EditText1"
oStaticText = oItem.Specific
oStaticText.Caption = "Static Text 1"
'//**********************************
'// Adding another Static Text item
'//**********************************
oItem = oForm.Items.Add("StaticTxt2", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 7
oItem.Width = 148
oItem.Top = 24
oItem.Height = 14
oItem.LinkTo = "ComboBox1"
oStaticText = oItem.Specific
oStaticText.Caption = "Static Text 2"
'//*************************
'// Adding a Text Edit item
'//*************************
oItem = oForm.Items.Add("EditText1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 157
oItem.Width = 163
oItem.Top = 8
oItem.Height = 14
oEditText = oItem.Specific
'// bind the text edit item to the defined used data source
oEditText.DataBind.SetBound(True, "", "EditSource")
oEditText.String = "Manish"
'//*************************
'// Adding a Combo Box item
'//*************************
oItem = oForm.Items.Add("ComboBox1", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oItem.Left = 157
oItem.Width = 163
oItem.Top = 24
oItem.Height = 14
oItem.DisplayDesc = True
oComboBox = oItem.Specific
'// bind the Combo Box item to the defined used data source
oComboBox.DataBind.SetBound(True, "", "CombSource")
oComboBox.ValidValues.Add("1", "Combo Value 1")
oComboBox.ValidValues.Add("2", "Combo Value 2")
oComboBox.ValidValues.Add("3", "Combo Value 3")
'//*************************
'// set the form as visible
'//*************************
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Carlos,
There is a sample code that does a transformation from .NET forms to B1 forms. It does not transform everything but at least the main components will be transformed. You can complete it to have everything transformed easily.
It is not already published in B1 main page but you can access to the article with the link:
and to the code sample with the link:
Hope it helps
Trinidad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
you can design it with ScreenPainter and then load it SDK.
it is much more faster to degign and loading it to the application
Private Function LoadXMLForm(ByVal strFileLocation As String) As SAPbouiCOM.Form
Dim SBOXMLDoc As System.Xml.XmlDocument
Dim SBOFormCreationParams As SAPbouiCOM.FormCreationParams
Dim SBOForm As SAPbouiCOM.Form
SBOXMLDoc = New Xml.XmlDocument
SBOXMLDoc.Load(strFileLocation)
SBOFormCreationParams = SBOApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
SBOFormCreationParams.XmlData = SBOXMLDoc.InnerXml
SBOForm = SBOApplication.Forms.AddEx(SBOFormCreationParams)
Return SBOForm
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 30 | |
| 26 | |
| 21 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 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.