Date Time Cell Type

Posted by: anupak on 8 September 2017, 3:21 pm EST

  • Posted 8 September 2017, 3:21 pm EST

    Hi

    I have a date time cell type. Basically I want to be able to have one cell for time. I achieved it by below code

    internal void sprdFromTo_CelldoubleClick(int Col, int Row)
    {
    isdoubleclicked = true;
    mForm.sprdFromTo.ActiveSheet.Cells[Row - 1, Col - 1].CellType = datetimecell;
    ((FarPoint.Win.Spread.CellType.DateTimeCellType)(mForm.sprdFromTo.ActiveSheet.Cells[Row - 1, Col - 1].CellType)).DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined; //*001*
    datetimecell.UserDefinedFormat = "HH:mm";
    datetimecell.TimeSeparator = ":";
    datetimecell.MinimumTime = TimeSpan.Parse("00:00:00");
    datetimecell.MaximumTime = TimeSpan.Parse("23:59:59.9999999");
    int year = Calendar.Now().Year;
    int month = Calendar.Now().Month;
    int day = Calendar.Now().Day;
    datetimecell.TimeDefault = new System.DateTime(year, month, day, 0, 0, 0);
    ((FarPoint.Win.Spread.CellType.DateTimeCellType)(mForm.sprdFromTo.ActiveSheet.Cells[Row - 1, Col - 1].CellType)).SpinButton = true;

    }

    now,problem is in vb first time if we click on spindown button no hh:mm will get displayed for datetime cell type but in c# it is giving the MaximumTime which i set in above line.I want the field to be blank.But dont know how to get the spinbutton down click event handle.

    Please help

    Thanks
    Anupa
  • Replied 8 September 2017, 3:21 pm EST

    Hi


    I am using Spread version 7.20.20132.1.Could u please try in that verson?

    Thanks
    Anupa
  • Replied 8 September 2017, 3:21 pm EST

    Hello,

    Unfortunately, we are unable to replicate the issue at our end with the given information using Spread version 9.35.20153.0

    We request you to send across a sample application or modify our application and send it across so that we can investigate this issue further.

    We are sorry further investigation of the issue is not possible with the provided information. We request you to send across additional information if you wish to continue the investigation.

    Thanks,
    Reeva
    2015/12/Spread_Win_VB_DateTimeCellType.zip

    2015/12/Spread_Win_CS_DateTimeCellType.zip
  • Replied 8 September 2017, 3:21 pm EST

    Hi,
    I am using Spread version 7.20.20132.1.I have attached the sample project also.

    Scenario :
    Double click on the cell the datetime cell should appear and click on down spin button immediately after double click it should not display anything(as compared with Vb6 datetimecelltype).But in C# ,it is giving the MaxTime.

    Please let me know if you have any queries

    Thanks
    Anupa
    2015/12/DatetimeCell.zip
  • Replied 8 September 2017, 3:21 pm EST

    Hello,

    We didn't receive any video from your end. Hence, please attach it again and using Spread version 7.20.20132.1, we get same behavior both for VB.Net and C#.Net applications wherein on clicking spin down button after double clicking the cell, it shows maximum value and which is correct behavior.

    Thanks,
    Reeva
  • Replied 8 September 2017, 3:21 pm EST

    Uploading the video again

    Thanks,
    Anupa
    2015/12/Video-datetime.zip
  • Replied 8 September 2017, 3:21 pm EST

    Hi,

    I am using VB6(MS Visual Basic 6.0(professional))not Vb.net.I need the same behavior of Vb6 in .net spread.Attached the video.

    Thanks
    Anupa

    2015/12/Video-datetime1.zip
  • Marked as Answer

    Replied 8 September 2017, 3:21 pm EST

    Hi,

    I tried this code in VB and C# and got similar results. I get a value in the cell if I click the down button.

    FarPoint.Win.Spread.CellType.DateTimeCellType datetimecell = new FarPoint.Win.Spread.CellType.DateTimeCellType();
    datetimecell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined;
    datetimecell.UserDefinedFormat = "HH:mm";
    datetimecell.TimeSeparator =":";
    datetimecell.MinimumTime = TimeSpan.Parse("00:00:00");
    datetimecell.MaximumTime = TimeSpan.Parse("23:59:59.9999999");
    int year = 2016;
    int month = 11;
    int day = 11;
    datetimecell.TimeDefault = new System.DateTime(year, month, day, 0, 0, 0);
    datetimecell.SpinButton = true;
    fpSpread1.ActiveSheet.Cells[1, 1].CellType = datetimecell;

    I found some older posts with information about using spin up or down events.

    http://sphelp.grapecity.com/forums/topic/numbercelltype-and-spinning-events/
    http://sphelp.grapecity.com/forums/topic/event-confusion/

    -Gina
  • Replied 8 September 2017, 3:21 pm EST

    Hi

    I have attached the video for vb and C# datetimecell and also sample vb project.I want the same behaviour in C#.

    Thanks
    Anupa


    2015/12/vbproj.zip
  • Replied 8 September 2017, 3:21 pm EST

    Hello,

    Unfortunately, we are unable to replicate the issue at our end with the given information using Spread version 7.20.20132.1 as well with your sample as well. Please have a look at attached video for the same and elt us know what are we missing to replicate the issue?

    Thanks,
    Reeva
    2015/12/Video_UnableToReplicate-3.zip
  • Replied 8 September 2017, 3:21 pm EST

    Hi Gina,

    I tried the same with GcDateTime cell.But as you said it is having different behaviour as compare to datetimecell.It is showing buttons in the same cell.I don't want that behaviour.

    Kindly let me know if you have any idea to do wrap option for the date time cell through code.

    Thanks
    Anupa
  • Replied 8 September 2017, 3:21 pm EST

    Hi,

    I was not able to find a wrap option for the date time cell. You might be able to use code in an event to control this.

    Another option might be to use a GcDateTime cell. It has more spin options, but it does not behave the same as the DateTime cell.

    For example:

    GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo testbutton = new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo();
    testbutton.Behavior = GrapeCity.Win.Spread.InputMan.CellType.SideButtonBehavior.SpinDown;
    testbutton.BackColor = Color.Red;
    testbutton.UseVisualStyleBackColor = false;
    GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo testbutton1 = new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo();
    testbutton1.BackColor = Color.Green;
    testbutton1.UseVisualStyleBackColor = false;
    testbutton1.Behavior = GrapeCity.Win.Spread.InputMan.CellType.SideButtonBehavior.SpinUp;

    GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType datecell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
    datecell.Spin.SpinMode = GrapeCity.Win.Spread.InputMan.CellType.DateSpinMode.Field;
    datecell.Spin.AllowSpin = true;
    datecell.SideButtons.Clear();
    datecell.SideButtons.Add(testbutton);
    datecell.SideButtons.Add(testbutton1);
    datecell.Spin.IncrementValue = new TimeSpan(2);
    fpSpread1.Sheets[0].Cells[0, 0].CellType = datecell;

    -Gina
  • Replied 8 September 2017, 3:21 pm EST

    Hi,

    Thank you for your tip.

    That works for getting the blank when clicking down button in empty cell.But now need to wrap the value incremented/decremented based on its Min/Max value.Is there any way to achieve that in datetimecell.I didn't find any property like spinwrap which is there in other celltypes.

    Thanks,
    Anupa
Need extra support?

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

Learn More

Forum Channels