How to change the data type of the bound column in C1TrueDBGrid?

Posted by: sservaja on 6 October 2017, 1:21 pm EST

    • Post Options:
    • Link

    Posted 6 October 2017, 1:21 pm EST

    In windows Form, added C1TrueDBGrid and trying to add new column with different data type. Grid is not bind to any data source yet. Still it is not allowing me to change the data type from string. It is complaining about "Property value is not valid’ Cannot change the type of the bound column.

    Any quick help is appreciated

  • Posted 9 October 2017, 3:30 am EST

    Hi,

    I am sorry to mention but I could not replicate the issue at my end. Please refer the attached sample.

    Could you please either modify the attached application or provide your own stripped down project so that I can try reproducing the same behavior at my end and assist you further accordingly?

    You may also try using the latest build and see if the problem persists. You can download the same from here:

    http://prerelease.componentone.com/dotnet40/c1winforms/2017-t2/C1WinForms.4_4.0.20172.271.zip

    Thanks,

    MohitTrueDBGrid_NewColumn.zip

  • Posted 9 October 2017, 9:50 am EST

    Hi Mohit

    Thank you for your reply. Unfortunately I am not able to open your project to check. Attached is my VS2010 project with C1TrueDBGrid. I have added three columns. Try to change the datatype of the third column LinkageID to Int32. you will get this message "Property value is not valid’ .C1TrueDBGridNewColTest.zip

    Thank you.

  • Posted 9 October 2017, 3:55 pm EST

    Hello Sujatha.

    I responded to your SupportOne case but just to close to the loop here.

    If you set the DataField property of a column, TrueDBGrid considers it a data bound column (as DataField sets the field in the data source). When data bound, the column type is set based on the data source, you cannot set DataType manually. This is to avoid a situation where it pulls a int data source and then the grid allows you to enter float or string values and then will have errors when you try to commit the changes back to the data source.

    If your trying to set the column name for an unbound grid, use the Caption property rather than DataField.

    Andy

  • Posted 10 October 2017, 9:10 am EST

    Hi Andy,

    Thank you very much for your descriptive answer. It worked now.

    Thank you again,

    Sujatha

Need extra support?

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

Learn More

Forum Channels