Re: Gridview Linq Query

"Booth, Bill" <[email protected]> Thu, 11 Sep 2008 12:18:10 -0500
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <007EEAA9361F684C8633FDC5D0D6905101CCD215@xnoho2.palicexchange.ads>
Thank=20you=20very=20much.

-----Original=20Message-----
From:=20Discussion=20of=20development=20on=20the=20.NET=20platform=20using=
=20any=20managed
language=20[mailto:[email protected]]=20On=20Behalf=20Of=20Pe=
ter
Ritchie
Sent:=20Thursday,=20September=2011,=202008=2011:47
To:[email protected]
Subject:=20Re:=20[DOTNET-CLR]=20Gridview=20Linq=20Query

It's=20because=20GridViewRowCollection=20implements
System.Collections.IEnumerable=20(for=20whatever=20reason).=20=20This=20is=

essentially
the=20same=20as=20System.Collections.IEnumerable<Object>--which=20is=20why=

everything=20is=20an=20Object.=20=20VB.NET=20is=20happy=20to=20accept=20th=
at=20at=20compile
time,
leaving=20it=20to=20deal=20with=20it=20a=20runtime.

You=20need=20to=20tell=20the=20compiler=20the=20information=20it=20can't=20=
infer,=20for
example:
=20Dim=20gridList=20As=20IEnumerable(Of=20GridViewRow)=20=3D=20customerGri=
d.Rows
=20Dim=20customerList=20=3D=20From=20cust=20In=20gridList=20_
=20=20=20=20Select=20cust.Cells(4).Text=20_
=20=20=20=20Distinct

Cheers=20--=20Peter

On=20Thu,=2011=20Sep=202008=2010:46:09=20-0500,=20Booth,=20Bill
<[email protected]>=20wrote:

>Hi=20All,
>I=20am=20trying=20to=20run=20a=20Linq=20query=20on=20a=20GridView=20Rows=20=
Collection=20that=20will
>select=20the=20distinct=20contents=20of=20one=20cell.=20The=20query=20bel=
ow=20will=20do=20the
>job;=20however,=20it=20uses=20late=20binding.=20The=20variables=20cust=20=
and=20customerList
>are=20both=20object=20types.=20I=20just=20cannot=20seem=20to=20get=20arou=
nd=20this.
>Any=20advice=20will=20be=20appreciated.
>Bill
>
>Dim=20gridList=20As=20GridViewRowCollection=20=3D=20CustomerGrid.Rows
>
>
>Dim=20customerList=20=3D=20From=20cust=20In=20gridList=20_
>=20=20=20=20=20Select=20cust.Cells(4).Text=20_
>=20=20=20=20=20Distinct
>
>For=20Each=20i=20In=20customerList
>=20=20=20=20=20=20Debug.WriteLine(i)
>Next
>
>The=20information=20in=20this=20e-mail=20is=20confidential,=20may=20be=20=
legally
privileged
and=20is=20intended=20solely=20for=20the=20addressee.=20If=20you=20have=20=
received=20this
e-mail
in=20error,=20you=20are=20hereby=20notified=20that=20any=20use,=20distribu=
tion,=20or=20copying
of=20this=20communication=20is=20strictly=20prohibited.
>
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>This=20list=20is=20hosted=20by=20DevelopMentor(r)=20=20http://www.develop=
.com
>
>View=20archives=20and=20manage=20your=20subscription(s)=20at
http://discuss.develop.com

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This=20list=20is=20hosted=20by=20DevelopMentor(r)=20=20http://www.develop.=
com

View=20archives=20and=20manage=20your=20subscription(s)=20at
http://discuss.develop.com

The=20information=20in=20this=20e-mail=20is=20confidential,=20may=20be=20l=
egally=20privileged=20and=20is=20intended=20solely=20for=20the=20addressee=
.=20If=20you=20have=20received=20this=20e-mail=20in=20error,=20you=20are=20=
hereby=20notified=20that=20any=20use,=20distribution,=20or=20copying=20of=20=
this=20communication=20is=20strictly=20prohibited.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com