> Is there a way to somehow have the Cols fields auto number themselves, or
> is
> there an overall better way to keep track of your columns so it's easy to
> locate them for showing/hiding?
I have to say I'm scratching my head as to why you need a separate class
just for this...?
Why not just use a generic e.g. Dictionary<string, int> or Dictionary<int,
string>...?

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
John Walker - 22 May 2008 18:57 GMT
Mark,
Would you please give me an example of how to use Dictionary? I've never
used that before.
Thanks
> > Is there a way to somehow have the Cols fields auto number themselves, or
> > is
[quoted text clipped - 6 lines]
> Why not just use a generic e.g. Dictionary<string, int> or Dictionary<int,
> string>...?
Mark Rae [MVP] - 22 May 2008 19:16 GMT
[top-posting corrected]
>>> Is there a way to somehow have the Cols fields auto number themselves,
>>> or
[quoted text clipped - 11 lines]
> Would you please give me an example of how to use Dictionary? I've never
> used that before.
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
John Walker - 22 May 2008 19:46 GMT
> [top-posting corrected]
>
[quoted text clipped - 15 lines]
>
> http://msdn.microsoft.com/en-us/library/xfhwa508.aspx
I see how that could work for me as i could programmatically assign the
column order at runtime, though the great thing i find about using a Class is
that intellisense will show me all the column names of the class so i dont
have to remember the exact spelling.
For example,
dg.Columns(Cols.TruckerCode).Visible = False
i would just need to remember that Cols is my class and then i just choose
the column name from the list. i dont 100% understand the Dictionary but i
did not see how to do something similar with intellisense.
Thanks
Mark Rae [MVP] - 22 May 2008 20:01 GMT
> I see how that could work for me as i could programmatically assign the
> column order at runtime, though the great thing i find about using a Class
[quoted text clipped - 9 lines]
> i
> did not see how to do something similar with intellisense.
Yes but, as you've discovered, every time your datasource changes you need
to rewrite your Class...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net