cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Multiple Forms

Former Member
0 Kudos

Hi All,

i have created a purchase requisition .upon clicking the form the form it's opening and the values are appended to it.upon again clicking the form while the first form is active the second is throwing the exception form not intialized.can anyone provide the code for multiple forms to be opened at a time

With Regards

Micheal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You want to open more forms or one the same?

If the same without error, create the instance of form in try catch statement, when the form exist, you will use the existing. If new one, create new instance of form.

Former Member
0 Kudos

Yeah,

i want two forms to be opened at a time i.e for a click one form should be appear and for the other another form should be opened(ex opening two sales order's at a time one after the other without disconnecting the addon)

Former Member
0 Kudos

ok, Im expecting, that you opening the form in menu event after click to menu. In the menu event create new the same form with other formUID (for example MyForm1 - MyFormN). The number of next form you should find out as

For Each PO_frm In SBO_Application.Forms

If InStr(PO_frm.UniqueID, "MyForm") > 0 Then

...

End If

Next

SBO_Application.Forms.Add(formuid as string, ...

Former Member
0 Kudos

is it sufficient or we have to make changes in form load functions

Former Member
0 Kudos

In ui api help is written:

In the SAP Business One application, each form must have an ID that is unique per application instance. The SAP Business One forms use an incremental number with an "F_" prefix as ID.

So I think that this is only way.

Former Member
0 Kudos

@ petr

i tried my best.it isn't coming .is any other way for multiple forms

Former Member
0 Kudos

Try this Code

use a Function to Loadyour Screen

Public Function LoadScreenXML(ByVal FileName As String, ByVal Type As enuResourceType, ByVal FormType As String) As SAPbouiCOM.Form
            intTotalFormCount += 1
            Return LoadScreenXML(FileName, Type, FormType, FormType & intTotalFormCount)
        End Function

When u Load a Screen Use This Method

objForm = objAddOn.objUIXml.LoadScreenXML("Carton.xml",.enuResourceType.Embeded, FORMTYPE)
        objForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
        objForm.Visible = True
Declare the FormType As String

For Ex:

Private FormType AS string ="CAS001"

Now Call this from ur Menu ID

Regards

Zubair

Former Member
0 Kudos

Thnx for the answer zubair

what is enuResourceType.is it sapbouicom.ResourceType

when i am declaraing this error is coming at enuresourcetype@ ByVal Type As enuResourceType<.can u help in exactly defining it. i am still a learner in b1

former_member209699
Contributor
0 Kudos

HI

I am doing

Function Loadyour Screen

Public Function LoadScreenXML(ByVal FileName As String, ByVal Type As enuResourceType, ByVal FormType As String) As SAPbouiCOM.Form

intTotalFormCount += 1

Return LoadScreenXML(FileName, Type, FormType, FormType & intTotalFormCount)

End Function

Load a Screen

objForm = objAddOn.objUIXml.LoadScreenXML("Carton.xml",.enuResourceType.Embeded, FORMTYPE)

objForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE

objForm.Visible = True

Declare the FormType As String

I am doing the same thing in form load.

But how to handle the current form in Item event.

PLz help me out

former_member209699
Contributor
0 Kudos

The error comes because you are not handling multiple instances of same form.

I also need help in this context. This is the senario of handling multiple instances.