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 11:13 PM UTC

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 What are you doing differently to see the problem? WindowsApplication7_6772.zip

AD Administrator Syncfusion Team December 7, 2004 03:29 PM UTC

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 03:51 PM UTC

Try this link.

AD Administrator Syncfusion Team December 7, 2004 03:58 PM UTC

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 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 04:35 PM UTC

I don''t see this problem with that sample in or in 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.

Live Chat Icon For mobile
Up arrow icon