C1DateEdit in InputPanel

WinForms

ComponentOne's WinForms controls

C1DateEdit in InputPanel

  • rated by 0 users
  • This post has 3 Replies |
  • 0 Followers
  •  based on "http://helpcentral.componentone.com/CS/forums/storage/86/213413/InputPanelRichTextBox.zip" i created a class with this code:

    Imports C1.Win.C1InputPanel
    Imports System.Windows.Forms

    Public Class DateEditHost
        Inherits InputControlHost

        Public Sub New()
            MyBase.New(New C1.Win.C1Input.C1DateEdit)
        End Sub
        Public ReadOnly Property C1DateEdit() As C1.Win.C1Input.C1DateEdit
            Get
                Return DirectCast(Control, C1.Win.C1Input.C1DateEdit)
            End Get
        End Property

      
    End Class

    I used the InputControlHost to put the c1dateedit in the inputpanel but when i set the FormatType property  of the C1DateEdit to ShortDate when i run the project the control shows the data in Default Format and when i stop running the project the FormatType has been reset to DefaultFormat.

    My version is 2.0.20082.28

    Thanks for help.

    Is there anyway to add a property in InputDatePicker which the user can use the keyboard to set the date?

    Thanks again

  •  Sorry it's Ok in later versions

  • Hi,

    I would rewrite this class as follow:

    Imports System.ComponentModel
    Imports C1.Win.C1InputPanel
    Imports C1.Win.C1Input

    Public Class DateEditHost
        Inherits InputControlHost

        Public Sub New()
            MyBase.New(New C1DateEdit())
        End Sub

        Public ReadOnly Property C1DateEdit() As C1DateEdit
            Get
                Return DirectCast(Control, C1DateEdit)
            End Get
        End Property

        ''' <summary>
        ''' Enumeration value determining the formatting method.
        ''' </summary>
        <Category("Format")> _
        <Description("Enumeration value determining the formatting method.")> _
        <DefaultValue(FormatTypeEnum.DefaultFormat)> _
        Public Property FormatType() As FormatTypeEnum
            Get
                Return C1DateEdit.FormatType
            End Get
            Set(ByVal value As FormatTypeEnum)
                C1DateEdit.FormatType = value
            End Set
        End Property

        ''' <summary>
        ''' Gets or sets the date/time value.
        ''' </summary>
        <Category("Data")> _
        <Description("Gets or sets the date/time value.")> _
        Public Property DateTime() As DateTime
            Get
                Return C1DateEdit.Value
            End Get
            Set(ByVal value As DateTime)
                C1DateEdit.Value = value
            End Set
        End Property

    End Class

    Though I don't see why you need to put a C1DataEdit into the InputControlHost
    if we have already the InputDatePicker and InputTimePicker native components
    in C1InputPanel.

    Regards,

    -Andrey
  • You are right i mentioned in my previous reply.

    Thanks anyway

Page 1 of 1 (4 items)