Skip to Content
author's profile photo Former Member
Former Member

show winform in an Activex Control

hi all,

usually their is an option to show web Form in an activex Control with the help of the code mentioned below.

Dim oForm As SAPbouiCOM.Form
        Dim creationPackage As SAPbouiCOM.FormCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

        Try
            creationPackage.UniqueID = "MFormIEID"
            creationPackage.FormType = "sdf"
            creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable

            '// Add the form to the SBO application
            oForm = SBO_Application.Forms.AddEx(creationPackage)
        Catch ex As Exception
            SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)

            Try
                oForm = SBO_Application.Forms.Item("MFormIEID")
            Catch ex2 As Exception
                SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
                Exit Sub
            End Try
        End Try

        oForm.Visible = True

        Dim oItemX As SAPbouiCOM.Item
        Dim oActX As SAPbouiCOM.ActiveX
        Dim oWebX As SHDocVw.WebBrowser
        Try
            oForm.Width = 700 ' get or create some form before
            oForm.Height = 500
            oItemX = oForm.Items.Add("xyz", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
            oItemX.Height = oForm.Height - 28
            oItemX.Width = oForm.Width - 8

            oActX = oItemX.Specific
            oActX.ClassID = "Shell.Explorer.2" 'or use the GUID "{8856F961-340A-11D0-A96B-00C04FD705A2}"
            oWebX = oActX.Object
            ' go "Home"
            oWebX.GoHome()
            ' or go to SMP
            oWebX.Navigate("http:\\www.google.com")
        Catch ex As Exception
            SBO_Application.MessageBox(ex.ToString)
        End Try

in the same way i need to show a windowform (vbform) in to ActiveX Control.

can anyone give me the sample...?

regards,

Rob

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 05:37 AM

    Hi,

    You'd better create a .net ActiveX control and embed your win form into it, then you can add it into B1 form in the usual way.

    There is an article about how to create a ActiveX in .net.

    http://www.codeproject.com/KB/cs/CreateActiveXDotNet.aspx

    C# sample code of embedding a form into a user control (your ActiveX control):

    //insert the following code into the user control class constructor
    WinForm form = new WinForm();
    form.TopLevel = false;            
    form.BackColor = Color.Black;
    form.Size = new Size(200, 80);
    form.Location = new Point(10, 10);
    form.FormBorderStyle = FormBorderStyle.None;         //to hide the title bar
    this.Controls.Add(form);
    form.Show();
    

    Have a try and good luck!

    Cheers,

    Tedy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 11:56 AM

    hi,

    i am not able to understand the Activex code which you have given in link.

    here is my task.

    i did a treelist view control in vb form.

    and i created a sapb1 form.

    now i want to integrate this vb form in to sap form.

    can i get any solution

    regards,

    sm

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.