Time datatype format for a column?

Posted by: qwerty450yahoo-ca on 27 September 2017, 9:11 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 9:11 pm EST

    Hi C1,

    I need your help, I hope you have the solution for me. I have a C1Flexgrid, I need to set the format of a editable column to “time”. So I want the column to display the time on the format (for example) “12:25”. The user can only change the time of the column (impossible to enter alphabetic or time greater than 24 and all the other validation possible.

    Thank you,

    Pascal

  • Posted 27 September 2017, 9:11 pm EST

    Hi,

    You have to set the Column’s DataType to DateTime and Format as “t”.

    Via Designer: (see attached image)

    Via Code:

    C#:

    [csharp]c1FlexGrid1.Cols[1].DataType = typeof(DateTime);

    c1FlexGrid1.Cols[1].Format = “t”;[/csharp]

    VB:

    [vb]c1FlexGrid1.Cols(1).DataType = GetType(DateTime)

    c1FlexGrid1.Cols(1).Format = “t”[/vb]

    ~nilay

  • Posted 27 September 2017, 9:11 pm EST

    Thank you. I tried the two options but separately. They work better together !

    But I have a few more questions :

    First, when the cell gets the focus, by default, a ComboBox appear (see picture #1), I want to delete this combobox.

    Subsequently, when the cell get into edit mode, 2 small arrows displays (see picture #2), I want to delete those.

    Third,when the user enter le 2 digits of the hour, I want the cursor to move automatically to the minutes, is it possible ?

    Finally when the user complete the minutes, I want to focus move to the next cell across, how can I do that ?

    Thank you

    Pascal

  • Posted 27 September 2017, 9:11 pm EST

    Hi,

    The first 3 requirements of yours can be met by setting the EditMask for the column to “00:00”. Attached is a small project showing the same. Regarding the last requirement, we would like to clarify the requested behavior here. Do you want the focus to move away automatically or is it manual? Though you can make the automatic jumps between cells while editing,it does not seems good for user experience. The user can always move the focus to the next cell using the arrow keys once he has completed entering the values.

    Regards,

    Ankit

    2017/03/prj_TimeType.zip

  • Posted 27 September 2017, 9:11 pm EST

    Great !

    Thanks both of you for your help, I really appreciate it.

  • Posted 24 May 2019, 4:01 am EST

    Dear Sir/Mam,

    I have a problem to this regard that when I set:

    FlexReport.DataSource.Recordset = dummyData;

    I don’t know how to format data conditionally like

    1. blank for zero values

      2.conditional fonts and much more…

    kindly request you to suggest the solution.

    Best Regards-

    Sanjeeb

  • Posted 24 May 2019, 6:12 am EST

    Hello Sanjeeb,

    I have responded to your query on the following forum thread:

    https://www.grapecity.com/forums/winforms-edition/c1report-is-now-obsolete-t#paginate-2

    I request you to respond to the same thread to avoid confusion.

    Thanks and Regards.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels