ArgumentOutOfRangeException was unhandled. Upon using keyboard and mouse click in datagrid. (Datagrid with SQL Dataset)

Dec 22, 2008 at 2:25 AM
Edited Dec 22, 2008 at 2:29 AM

Hi Everyone,

This error occured in my wpf datagrid: 

ArgumentOutOfRangeException was unhandled
Specified argument was out of the range of valid values.
Parameter name: index

This error occured everytime that I edit the item in column 3, row 3. After I was edited the item. I use my mouse pointed to column 2, row 3 (by clicking once) then afterwards I clicked the arrow right key to proceed to the column 3, row 3.

Col1      |       Col2      |        Col3      |     Col4                             <- Column
Row1    |       Row1    |        Row1     |    Row1
Row2    |       Row2    |        Row2     |    Row2                             <- Rows
Row3    |       Row3    |        Row3     |    Row3
Row4    |       Row4    |        Row4     |    Row4

My code to view the items in the datagrid are the ff: 

' Fill the database
io_sql = New FLSKP_LIB.SQL  

With io_sql
.SQLQuery = "select * from users"
End With



' Initialized the datagrid
' Bind dataset to the datagrid
mainGrid.ItemsSource = io_sql.GetDataSet.Tables("tbl").DefaultView

The error is unhandled that's why I can't able to try and catch the problem. Can someone help me on this error to solve. Is it a bug of a WPF datagrid or an error on my coding?

Thank You for your help.



Dec 22, 2008 at 8:34 PM
Edited Dec 22, 2008 at 8:35 PM
Hi Junicef,

We are aware of this issue. Unfortunately this is neither a problem of your code nor an issue with WPF datagrid. This is a bug in (That is the reason why it repros only with SQL DataSet). We are in discussions with team to get this fixed. Also unfortunately there is no external workaround for this.
Dec 22, 2008 at 11:21 PM

Hi VamseeP,

Thank you very much for the information. I'm hoping that the team will give patch on this issue because it's totally a bad impact our users on the system. Do you have any temporary solution on this thing? I tried to use the dataset.acceptchanges and the error was not appeared. However if I modify three records, then only one record will be saved.