We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Inserting new rows: what can be simplier?

I''m trying to have Following code throws me an exception. I can''t find what am I doing wrong. Removing primary key makes it work, but... private void Form1_Load(object sender, System.EventArgs e) { Syncfusion.Windows.Forms.Grid.GridDataBoundGrid grid = new Syncfusion.Windows.Forms.Grid.GridDataBoundGrid(); grid.Parent = this; DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add("myTable"); for (int i=0; i<3; i++) { DataColumn col = dt.Columns.Add("myColumn_" + Convert.ToString(i), typeof(int)); } dt.Columns[0].AutoIncrement = true; // create primary key dt.Constraints.Add("myConstraint", dt.Columns[0], true); DataView dv = new DataView(dt); dv.AllowNew = true; dv.AllowEdit = true; dv.AllowDelete = true; grid.DataSource = dv; }

5 Replies

AD Administrator Syncfusion Team November 3, 2004 06:13 PM

I pasted your code into this sample to try to see the problem. As long as I type integers into the cells, I do not see any exceptions. I am using 2.1.0.9. What are you doing differently to see the problem? WindowsApplication7_6772.zip


AD Administrator Syncfusion Team December 7, 2004 10:29 AM

I''ve been travelling, and wasn''t able to look at this issue, and now file is no longer available... Thanks!


AD Administrator Syncfusion Team December 7, 2004 10:51 AM

Try this link. http://64.78.52.104/support/user/Uploads/WindowsApplication7_6772.zip


AD Administrator Syncfusion Team December 7, 2004 10:58 AM

Much appreciated. This program throws me: "An unhandled exception of type ''System.Exception'' occurred in system.dll Additional information: is not a valid value for Int32." after the last line "grid.DataSource = dv;" It''s the same thing I was getting before. I have 2.1.0.67 installed, XP Pro .NET 1.1 patched with the latest MS updates... By the way, making "dv.AllowNew = false" fixes it instantly. However in my project I would need to insert data in the grid somehow.


AD Administrator Syncfusion Team December 7, 2004 11:35 AM

I don''t see this problem with that sample in 2.1.0.9 or in 3.0.0.19. You might want to download the 3.0 RC and try that. It uses a different assembly naming scheme so both 2.1.x and 3.0.x can be on the same system without worrying about getting assembly name conficts. You do habe to change the references to point to the proper assemblies.

Loader.
Live Chat Icon For mobile
Up arrow icon