Results 1 to 1 of 1
  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2018

    DatagridView - Currentrow Selection Error

    Hello friends and happy new year! This is my first post in this forum! I am confused about an error in my vb.net application. I have a datagridview which is databound on a bindingsource. I have datadrigview SelectionMode to FullRowSelect. When the form is loaded I have:
    Me.BuildingsTableAdapter.Fill(Me.PolwarehouseDataSet.buildings) ' buildings
    Me.PeriodsTableAdapter.Fill(Me.PolwarehouseDataSet.periods) ' periods
    Me.PhasesTableAdapter.Fill(Me.PolwarehouseDataSet.phases) ' phases
    I can see all the data (2 rows). The problem appears when I press the second row. I have the below message:
    Name:  error.png
Views: 147
Size:  97.8 KB
    After I pressed OK I can move to any of the rows. Sometimes I lose the cell values on the Period Field on datagridview, no the database. I understand that when I select other rows, something goes wrong and delete the value in my not null field and I have the error. But I cannot understand why it removed from the datagrid. I follow this https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx from Microsoft and I get the error: Error happened commit, commit error.

    EDIT. I found something interesting. Below the datagridview I have the same fields in details mode. There I have 2 comboboxes which are databound to lookup tables.
    When form loaded I clear selection datagridview and set the comboboxes selected index to -1. Then I have the error. But If I do not set selectionindex to -1. I have not any error, but when I select other row, datagridview change values to those 2 fields with the selectedindex=0. I continue to see this in datagridview and no in database until I press the save button. So this is a very critical error.

    The same issue happened when I sort datagridview, via pressing any column name.

    Here is the datagrid:
    Name:  error2.jpg
Views: 135
Size:  5.2 KB
    Thanks in advance!
    Sorry for my level of English!
    Last edited by djprinces; Jan 8th, 2018 at 05:48 AM. Reason: New data

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.