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

DataGrid and hide column

Hi, I've tried the code in the FAQ How to Hide a Column http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q708q you gave with GridColumnStyles to the Datagrid's TableStyles. class MyClass { ... ArrayList myList; ... public void AddObj(Obj o) { this.myList.Add(o); } } ... class Obj { string Name1; ..... string NameX; } I'd like to display in a datagrid just Name1 or Name2 for example. I've tried a "normal" table (DataTable) and there is no problem , but for my ArrayList of objects, an ArgumentOutOfRangeException is called : the mapping is not done. Here is my code : dataGrid1.DataSource = myClass.myList; // DataGrid settings DataGridTableStyle dgts = new DataGridTableStyle(); dgts.MappingName = "myClass.myList"; dataGrid1.TableStyles.Add(dgts); dgts.GridColumnStyles[2].Width=0; dgts.DataGrid.Refresh(); Where is the error ? Thanks vinh

Live Chat Icon For mobile
Up arrow icon