on 09-21-2008 4:08 PM
Hi all,
I have created a menu & submenu and I open a form (PRMain) ONLY the first I choose it. If I close it and reopen it doesn't open again. Any Idea?
Here is the Code:
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If pVal.BeforeAction = False Then
Select Case pVal.MenuUID
Case "SM_VID_F1"
If (pVal.MenuUID = "SM_VID_F1") And (pVal.BeforeAction = False) Then
Try
Dim f As SAPbouiCOM.Form
f = SBO_Application.Forms.Item("PRMain")
f.Select()
Catch ex As Exception
Drawform()
End Try
End If
Case "SM_VID_F2"
RunExpert()
End Select
End If
End Sub
Thanks in advance.
Vangelis
Hi,
Try this.
Your Main subroutine should be like this. Application.run() keeps the main thread alive.
Public Sub Main()
objAddOn = New clsAddOn
System.Windows.Forms.Application.Run()
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use this code to launch a form designed by screen painter.
Public Function LaunchForm(ByVal strFormType As String, ByVal strXMLPath As String, ByVal strUniqueId As String, Optional ByVal bFocusExistingForm As Boolean = False, Optional ByVal strMsgIfExists As String = "Form Already Exists!") As SAPbouiCOM.Form
Dim oForm As SAPbouiCOM.Form
Try
Try
oForm = objSbo.SBO_Application.Forms.Item(strUniqueId)
Try
'Form already exists
If bFocusExistingForm Then
'Set Focus to the existing form
oForm.Select()
Else
Call objSbo.SBO_Application.MessageBox(strMsgIfExists)
End If
Catch e As Exception
End Try
Catch e As Exception
Dim strPath As String
Dim fcp1 As SAPbouiCOM.FormCreationParams
fcp1 = objSbo.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
fcp1.BorderStyle = BorderStyle.FixedSingle
fcp1.FormType = strFormType
fcp1.UniqueID = strUniqueId
fcp1.XmlData = LoadFromXML(strXMLPath)
oForm = objSbo.SBO_Application.Forms.AddEx(fcp1)
End Try
Catch ex As Exception
' Call WriteLogFile(ex.Message, "LaunchForm")
End Try
Return oForm
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Geetha,
I tried
fcp1.XmlData = LoadFromXML("PRM_MAIND.srf")
where
Private Sub LoadFromXML(ByRef FileName As String)
Dim oXmlDoc As Xml.XmlDocument
oXmlDoc = New Xml.XmlDocument
'// load the content of the XML File
Dim sPath As String
sPath = IO.Directory.GetParent(Application.StartupPath).ToString
oXmlDoc.Load(sPath & "\" & FileName)
'// load the form to the SBO application in one batch
SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)
End Sub
but no success
Any Idea?
Hi Vangelis,
please try:
Public Function LoadFromXML(ByVal FileName As String) As String
Try
Dim oXmlDoc As Xml.XmlDocument
oXmlDoc = New Xml.XmlDocument
' load the content of the XML File
Dim sPath As String
'sPath = IO.Directory.GetParent(Application.StartupPath).ToString & "\"
sPath = (Application.StartupPath).ToString & "\"
oXmlDoc.Load(sPath & FileName)
Return (oXmlDoc.InnerXml)
Catch e As Exception
Call objSbo.SBO_Application.MessageBox(e.Message)
End Try
End Function
User | Count |
---|---|
108 | |
12 | |
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.