"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:...
> The code could not be simpler:
> Dim txtProjectID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox)
>
> Dim dblProjectID As Double = CDbl(txtProjectID.Text)
>
>
> Run-time exception thrown : System.ArgumentOutOfRangeException - Specified
> argument was out of the range of valid values.
> Parameter name: index
>
> e.Item.Cell(1) is valid. When I take away the READONLY attribute
everything
> works fine. What is really bizzare is that ALL Cells throw the same error
> when I set the READONLY attribute to TRUE. When I remove it I can
reference
> all Cells in the Quickwatch window and in code. ProjectID is one of two
> keys. The end-user should never change my keys in this app.
>
> To make it even more interesting, I have another simple app (simple
> code/description table) that does not exhibit this behavior.
>
> What gives?
>
> Keith
>
>
When e.Item.Cells(1).Controls(0) is read only, there is no TextBox in it.
Get the value via a string instead. I donīt use VB usually, but it could
look like this in C# (without testing

:
string strProjectID = e.Item.Cells(1).Text;
/Marre