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

adding a .net components on a b1 form

hi

i want to add a .net date time picker control to a b1 form which i m creating at run time. how can i do it. plz send code.

Thanks & Regards : Amit Kumar

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 11:44 AM

    Hi Amit,

    this will help you but once you open date time picker you can not access SBO untill you select something in datetime picker control.

    Design a form with dateTimepicker Control(form size is equal to datetimepicker size)

    add the below code under your button item pressed Event

    newThread = New System.Threading.Thread(AddressOf DateTimePicker)

    newThread .ApartmentState = Threading.ApartmentState.STA

    newThread .Start()

    newThread .Join()

    Private Sub DateTimePicker()

    Dim myForm As New frmDateTimePicker

    strFileToOpen = ""

    myForm.DateTimePicker1.Left = SAPBONEForm.Left - 100(SEt the properties relative to Where you want to show the control)

    myForm.DateTimePicker1.BringToFront()

    myForm.DateTimePicker1.Show()

    myForm.ShowDialog()

    DummyForm.DateTimePicker1.Select()

    strDate = DummyForm.DateTimePicker1.Text

    MsgBox(strDate )

    System.Threading.Thread.CurrentThread.Abort()

    End Sub

    And close the win form once the user selects the date

    Private Sub DateTimePicker1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.TextChanged

    Me.Close()

    End Sub

    If it helps please reward the points

    Regards

    Vishnu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi jusi

      add reference mscomctl2.dll form com components

      then in ur project write code like this

      using miccrosoft.visulbasic.comptability

      private mscomctl2.dtpicker dt1;

      // to add date time picker on the b1 form

      sapbouicom.activex dtstart;

      oItem = oForm.Items.Add("dtp_start", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X);

      oItem.Left = 117;

      oItem.Width = 82;

      oItem.Top = 28;

      oItem.Height = 18;

      dtstart = ((SAPbouiCOM.ActiveX)(oItem.Specific));

      dtstart.ClassID = "MSComCtl2.DTPicker.2";

      dtp1 = ((MSComCtl2.DTPicker)(dtstart.Object));

      oform.visible

      if u got any probs then contact me.

      regards: amit motla

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.