C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

C1DateEdit in InputPanel

rated by 0 users
This post has 3 Replies | 0 Followers

Top 50 Contributor
Posts 121
albertsmus Posted: Fri, Feb 27 2009 1:31 AM

 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

Top 50 Contributor
Posts 121

 Sorry it's Ok in later versions

Top 10 Contributor
Posts 1,644
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
Top 50 Contributor
Posts 121

You are right i mentioned in my previous reply.

Thanks anyway

Page 1 of 1 (4 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.