Databinding - ReadOnly Exception

Databinding - ReadOnly Exception

Post by Jorge Cavalheir » Wed, 28 May 2003 18:11:19

I have a textbox that is binded to datatable created from
a dataset. This dataset was created from 'dataset1.xsd'
with a single table. When i try to bind it with 'id' i
get a readonly error. The 'id' is the identity field
(auto counter no duplicates) of the table and i just want
to  read it not modify it. I have EnforceConstraints to
false on the dataset. Any suggestion would me most
welcome, thanks.

Kind Regards
Jorge Cavalheiro


1. Readonly DataGrid causes Out Of Range Exception when filling datasource (Framework 1.1)


Problem :

VS 2003

1. Place a DataGrid on a form
2. Drag a table from the server explorer on the form (generates
SQLDataAdapter and SQLConnection)
3. Generate the DataSet via the DataAdapter
4. Set the DataSource of the DataGrid to the Dataset
5. Set the ReadOnly property of the DataGrid to TRUE
6. Put the Fill Command of the DataAdapter to fill the Dataset in the
Form Load
7. Run the code

-> The DataAdapter.Fill generates an IndexOutOfRangeException which is
not catchable with Try...Catch block
-> The problem only happens when the DataSource of the DataGrid is set
and when
the ReadOnly Property is True during the Fill.
-> The error does not occur when before calling the Fill method the
following line of code is set :

DataGrid1.CurrentRowIndex = -1

-> The previous is no solution for me because the DataSource can be
filled in many places in the code where the DataGrid is not available

-> The exception is not raised when "Start without debugging"

-> Same exception is raised when using views and set the AllowAddNew
property to False.

-> This problem only occurs in VS.NET 2003 and works fine in the
previous VS.NET




2. French Oric books on Ebay

3. ReadOnly TextBox for ReadOnly Property?

4. Scanner & Linux

5. Listview databinding argument exception error

6. Adelphia Power link Cable modem service and Linux?

7. Databinding: Handling errors in the databound form

8. Where goes debug output ?

9. accessing the databinding values during a databind

10. Databinding question (ORDER of databinding)

11. To DataBind or Not To DataBind?

12. Tricky Problem, databinding within databinding

13. Exception Manager Internal Exception