Datagridview problem - adding empty rows

0
0

I have a form that loads data based off a textbox.  The textbox is filled by a keyboard wedge so when the @ is encountered, the KeyPress fires off a function to load data from a database into a bound data grid view.

The data is loaded fine into the data grid view, but there are extra blank rows added to the end of the data grid view.

I have included a sample application that shows the behavior.

If you type in “1@” the datagrid view will fill.  There will be 1 row added.  It is not coming from a database but from a “list(of test)”  This “list(of test)” is then being put into a  System.ComponentModel.BindingList so that it works with the datagridview.

 

If you type in “1@” again, you will see 1 row with data and then 1 blank row.

If you type in “1@” again, you will see 1 row with data and then 2 blank row.

The method of filling the data to a “list(of” and then putting that data into a BindingList is the method that we are using to get our list of custom objects into the datagrid.  If this method shouldn’t be used feel free to correct me.

 

Thanks,

Shawn

Attachment
  • You must to post comments
0
0

Hi Shawn,

WJ-8478 is fixed in the latest Wisej release (1.4.32).

Best regards
Frank

  • You must to post comments
0
0

Hi Shawn,

your sample also uncovered a problem in Wisej where adding a row to an empty bound list should replace existing rows in the DataGridView bound to that list. It´s logged as WJ-8478, fixed and will be included in the next Wisej release.

With this fix, the additional line of code I mentioned will not be needed anymore.

Best regards
Frank

  • You must to post comments
0
0

Hi Shawn,

you need to reset the datasource before assigning it again:

Please add

Me.DataGridView1.DataSource = Nothing

prior to

Me.DataGridView1.DataSource = mYTest

Hope that helps.

Best regards
Frank

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.