Skip to content

Datagridview problem - adding empty rows #1124

Closed

Description

@itg-assistant

Shawn Ramirez asked 2017-09-25 13:25:31 UTC

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

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-09-25 13:40:39 UTC

    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

  2. added
    BugSomething is broken or behaving unexpectedly.
    on Jun 12, 2026
  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Shawn Ramirez answered 2017-09-25 13:49:23 UTC

    That did the trick. Thanks

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-09-25 14:45:53 UTC

    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

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-10-02 19:30:09 UTC

    Hi Shawn,

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

    Best regards
    Frank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is broken or behaving unexpectedly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions