on 12-03-2007 6:03 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
95 | |
11 | |
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.