This is a migrated thread and some comments may be shown as answers.

Add a DateTimePicker to a CommandBar

4 Answers 254 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
zzz
Top achievements
Rank 1
zzz asked on 21 Jul 2011, 11:24 AM
Hi,
I would like to add 
a DateTimePicker to a CommandBar. Is this Possible? How can it be done?
Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 21 Jul 2011, 01:59 PM
Hi Zzz,

Thank you for your interest.

In the current version of RadCommandBar our masked edit box is not in the list of default items. There is a CommandBarHostItem that can host any RadElement, but it has no design-time support yet. After you add the host item, you can set the hosted element by code as it is shown below:

RadDateTimePickerElement radDateTimePicker= new RadDateTimePickerElement();
RadDateTimePicker.MinSize = new System.Drawing.Size(100, 0); 
commandBarHostItem1.HostedItem = radDateTimePicker;

Feel free to ask if you have any further questions.
Regards,
Peter
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Nikita
Top achievements
Rank 2
answered on 18 Jan 2012, 01:00 PM
OK
But how to read value from

DateTimePicker

0
Peter
Telerik team
answered on 20 Jan 2012, 06:05 PM
Hi Nikita,

In this case you should use the Value property of RadDateTimePickerElement. Here is a sample:

DateTime? time = radDateTimePicker.Value;

Kind regards,

Peter
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Nikita
Top achievements
Rank 2
answered on 20 Jan 2012, 06:42 PM
Hi Peter,
Thanks

My bad. I didn't declare globally and have that problem.

My code in VB:

Declare
 Dim radDateTimePicker1 As New RadDateTimePickerElement
 radDateTimePicker1.MinSize = New System.Drawing.Size(100, 0)
 CommandBarHostItem1.HostedItem = radDateTimePicker1

Read
 Report1.ReportParameters("DatumPrometa").Value = radDateTimePicker1.Value

Thanks
Tags
CommandBar
Asked by
zzz
Top achievements
Rank 1
Answers by
Peter
Telerik team
Nikita
Top achievements
Rank 2
Share this question
or