Sorry, my bad, I didn't read the code properly before posting! The way you have done it does not look too ugly to me if it makes you feel any better.
On Wed, Oct 27, 2010 at 12:19 PM, Arjang Assadi <[email protected]>wrote: > Hmm, no joy > > e.Value is cant not be happy as a expression for switch statement ( > compiler says so ). > would have been nice though. > > back to hideousity. > > Regards > > Arjang > > On 27 October 2010 13:09, Arjang Assadi <[email protected]> wrote: > > Yes and With extreme prejudice ! but didn't think it can be used > > inplace of "is". :) > > > > I'll try it now. > > > > Thank you > > > > On 27 October 2010 13:06, George Zafir <[email protected]> wrote: > >> Have you considered using a switch statement? > >> > >> On Wed, Oct 27, 2010 at 11:59 AM, Arjang Assadi < > [email protected]> > >> wrote: > >>> > >>> I need to do something similar to do this : > >>> > >>> if (e.Value is Book) > >>> { > >>> e.Value = (e.Value as X).Title; > >>> > >>> } > >>> else if (e.Value is Customer) > >>> { > >>> e.Value = (e.Value as Customer).FullName; > >>> } > >>> else > >>> { > >>> e.Value = "Unknown"; > >>> } > >>> etc. > >>> > >>> in DataGridView_CellFormatting even, but it just looks plain ugly. is > >>> there way to do this in a more structured manner? > >>> > >>> Regards > >>> > >>> Arjang > >> > >> > > >
