Bug in Datagrids

M

mfleet1973

Hi.

When testing my app I believe I found a bug in datagrids (or is it just
me).

Here is the scenario:

Grid is attatched to a dataview. Dataview has a filter. I enter a new
record within the datagrid and when I click on the fixed column (the
grey bar on the left with an arrow pointing right when record is
selected) of the last record, I receive an error "Index was outside of
the bounds of the array". The new record must be on top.

To make sure that it was not something in my app I created a very basic
app with only data adapter, dataset, dataview ,datagrid. the dataview
had a row filter and when I entered a new record and clicked on the
last record to save the info, I got the error.

Has this ever been reported before? I did a search in google groups
for this error message and didn't get any hits. Is there any known fix
for this?

Thanks.
 
S

Steven Nagy

1. Windows or web datagrid? Framework 1.1?
2. Are you handling any events in relation to the datagrid?
3. Post some code please, bare minimal example that demonstrates the
error

SN
 
M

mfleet1973

Hi.

1. I'm using a Windows Datagrid. I'm also using Framework 1.1.
2. The basic program that I wrote in which I got the error had no
events at all and I still got the same error.
3. The only code I have is loading the table and setting the row
filter of the dataview.

Note that it's an sql server database. I could try the same program on
an access database but I think that I would get the same error message.

Should I upgrade the .net framework?

Many Thanks!
 
S

Steven Nagy

Should I upgrade the .net framework?

Well yes, but not if its just to fix your problem!

Can you post your small example?
I will run it locally and see if I can recreate the bug.

SN
 
M

mfleet1973

Hi.

Sorry for not getting back right away.

Here is the code example.

Try
'Fill the dataset
SqlDataAdapter1.Fill(DataSet11, "TestTable")
'Set a row filter to make sure that only one record is in the
grid
DataView1.RowFilter = "TableUID = 1 or testfield = ''"
'Now create a blank row
nr = DataSet11.Tables("testtable").NewRow

With nr
.Item("testfield") = ""
End With

DataSet11.Tables("testtable").Rows.Add(nr)

Catch x As Exception
MsgBox(x.Message)
End Try

That's it....Make sure that the Dataview does not allow new records but
does allow editing.

Thanks.
 
S

Steven Nagy

Ok so the dataview is created in design mode and those properties are
added?
I can't look at this until the weekend sorry. I'll pull down your code
example and recreate the problem and have a look. Hope it can wait this
long.

Cheers,
Steven
 
M

mfleet1973

Hi...All data objects created in design time...Note the the new record
must be on top.

Thanks a lot!
 
S

Steven Nagy

Hi there,

Well I recreated your program as best I could.
But I could not recreate your problem at all.

Here's what I did:
1. Create new windows app in 1.1. Created a sql server table called
"Test" with a "TestID" and "TestField". TestID is PK and is an
identity.
2. In design mode created SqlDataAdapter, Dataset, and a dataview,
pointing the datagrid to the dataview, and the dataview to
Dataset1.Test table.
3. added your code in form_load (with slight adjustment for table
names).
4. Ran it and the filter worked. Could not cause an error. Clicked
everywhere.

So I am not sure what I can do next to recreate this.

Steven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top