Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Grid column names
posted

I'm relatively new to these controls so I hope I'm not asking an old question. I've searched the FAQ's and this forum quickly and didn't find any related posts.

I created a WinGrid based on a .NET dataset. I used the dataset designer in the IDE to create the dataset.  It all came together quite nicely. The question I have has to do with the column names. When referencing columns in a dataset throughout the code it is common to see the column name strings declared as constants and the constant name used in references instead of repeating the literal string. This makes maintenance a little easier.

It would be nice if the designer implementation for WinGrid made use of this, creating the constant strings (if they didn't already exist) and using them in the code it generates.

The current implementation forces WinGrid users to use the literal column name strings or to maintain the column names in both the dataset and in the constant definitions.

Is there a way to make this a little cleaner?

Parents
No Data
Reply
  • 17259
    Offline posted

    To make this happen for the grid you have to submit a feature request int the main site.

    You can achieve that easily with the dataset like that:

    grid.DisplayLayout.Bands[0].Columns[myDataset.Tables[0].MyColumn.ColumnName]

     

     

Children
No Data