Add a DateTimePicker to a CommandBar

5 posts, 1 answers
  1. zzz
    zzz avatar
    6 posts
    Member since:
    Jul 2011

    Posted 21 Jul 2011 Link to this post

    Hi,
    I would like to add 
    a DateTimePicker to a CommandBar. Is this Possible? How can it be done?
    Thanks
  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 21 Jul 2011 Link to this post

    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!

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikita
    Nikita avatar
    21 posts
    Member since:
    Jun 2011

    Posted 18 Jan 2012 Link to this post

    OK
    But how to read value from

    DateTimePicker

  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 20 Jan 2012 Link to this post

    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).

  6. Nikita
    Nikita avatar
    21 posts
    Member since:
    Jun 2011

    Posted 20 Jan 2012 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready