Int32 vs String

Posted by: sgmicro on 8 September 2017, 2:36 pm EST

  • Posted 8 September 2017, 2:36 pm EST

    Hello,

    I use a Dataset with 5 columns. One of this columns set to  Int32 type. I make   "grid.DataSource = MyDataSet" to fill my grid. I' haven' formatted my grid then all my columns are default type. 
    Pb : when my Int32 field set to "1234" it's ok by if i put "12345678" the value isn't visible on the grid.
    If i set type to NumberCellType for this column it's OK "12345678" is visible.
    How it doesn't work for default column   type ?
    I try that on 2 computer (same spread version) and it's the same thing)

    thks

    DT 

  • Replied 8 September 2017, 2:36 pm EST

    When you import Data from a Dataset Spread sets the celltype based on the data in the dataSet if you have SheetView.DataAutoCellTypes = True, which it is by default,, other wise the default celltype is the GeneralCellType and it has a NumberFormat property that takes a NumberFormatInfo Object which has a property NumberDecimalDigits which you can set to display your large numbers.

  • Replied 8 September 2017, 2:36 pm EST

    babe59,


    I am not am able to reproduce the issue you describe.  In my testing, I using code like the following and everything worked fine.


        DataTable dataTable = new DataTable();
        dataTable.Columns.Add("A", typeof(System.String));
        dataTable.Columns.Add("B", typeof(System.Int32));
        dataTable.Rows.Add(new object[] {"one", 1234});
        dataTable.Rows.Add(new object[] {"two", 12345678});


        DataSet dataSet = new DataSet();
        dataSet.Tables.Add(dataTable);


        fpSpread1.Sheets[0].DataSource = dataSet;


    Could you provide a sample that demostrates the issue?  Or could you provide a code to reproduce the issue?

  • Replied 8 September 2017, 2:36 pm EST

    here an example

    thks 


    2011/04/TestSpread.rar
  • Replied 8 September 2017, 2:36 pm EST

    Hello,

    The version of Spread you are using is the older version of Spread and I am unable to replicate the same with the latest version of Spread 4.0. Please have a look at the screenshot for the same and I would request you to upgrade your application to the latest build available which is 4.0.xx26.2008. You can get the latest build from this link.

    Thanks.



  • Replied 8 September 2017, 2:36 pm EST

    it's ok with latest version of spread V4

    thanks

     

Need extra support?

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

Learn More

Forum Channels