Hi,I found some code that I would like to convert to Progress but I can't manage that.Can someone help?
DataTable table =
GridViewDataColumn dataColumn = GridViewHelper.AutoGenerateGridColumn(column.DataType);
dataColumn.Name = column.ColumnName;
dataColumn.FieldName = column.ColumnName;
So I tried:define variable oDataTable as System.Data.DataTable no-undo.define variable oColumn as System.Data.DataColumn no-undo.define variable i as integer no-undo. assign oDataTable = cast(radGridView1:DataSource, "System.Data.DataTable").do i = 1 to oDataTable:Columns:Count: oColumn = cast(oDataTable:Columns[i], "System.Data.DataColumn"). message program-name(1) skip valid-object(oColumn) skip oColumn:ColumnName view-as alert-box. end.But I get the error 12869, something about wrong casting of a Progress.Data.BindingSourse to System.Data.DataTable.When I look to radGridView then the type of the DataSource is System.Object.But a System.Object has no Columns property.In the example they clearly use a System.Data.DataTable so why do I get errors there?RegardsDidier
Well apparently your grid is bound to a Progress BindingSource. The underlying data source for a ProBindingSource is NOT a .NET DataTable. That is why you are getting the casting error. You need to explain what you are really trying to do.
If you are just trying to list the columns of your table, you shouldn't be using the BindingSource to do it! The data is sitting right there in your ABL code - i.e,. it is the columns (i.e, fields) of the temp-table that the BindingSource is bound to (via a query or DataSet). If the code is in a place where it doesn't know what the underlying temp-table is - you could get the query handle from the BindingSource's Handle property (assuming you are bound to a query). Then you could get the associated buffer handle(s), etc.
Alternatively, you could ask the grid itself for its list of columns. Depends on what you're trying to do.
Thanks for that info.
This is my problem:
I use a Telerik RadGridView and I applied the Savelayout and ResumeLayout so a user can change his columns from place or the width of columns to whatever he want and this will be re-applied when he opens the form again .
The problem is that when you use that feature the following problem occurs:
All newly added columns will not be added to that GridView @runtime when there is a ResumeLayout where those columns do not exist in (what is always the case because those columns didn't exists when the file that is used with the ResumeLayout is created.
So I can delete that file if i have a new definition of the columns but then the user looses his changes to those columns or I can try to add the missing columns. For this I found the following Forum-topic --> www.telerik.com/.../3.
So I was just trying to implement this solution