Can only edit NULL cells in DataGridView

chris_asa

Active member
Joined
Sep 4, 2009
Messages
26
Location
Switzerland
Programming Experience
10+
I usually populate DataGridViews manually from a disconnected DataTable.
It works, but it is ...well, boringly manual.

Today I'm experimenting with binding a DGV to the disconnected datatable.

I have a class with some simple properties plus a datatable.
e.g.

VB.NET:
Friend Class oCase

  'a simple property
  Private pCaseID as integer = 0
  Friend property CaseID() as integer
    get
      return pCaseID
    end get
    set (byval value as integer)
      pCaseID = value
    end set
  end property

  'a datatable
  Friend myDT as datatable = New datatable

End class

Elsewhere: Friend CurrentCase as oCase = New oCase and SQL-Server stored procedure ---> DataReader ---> CurrentCase.myDT
In a form with a DataGridview named dgvCaseInfo I can manually populate/harvest the DGV from/to DT, save DT back to DB. Everything works. :D

So on with the DGV binding experiment
Comment out the populate/harvest and try:
dgvCaseInfo.Datasource = CurrentCase.myDT

dgvCaseInfo is populated as desired :D

BUT

In dgvCaseInfo, any cell containing a value that was not NULL in the db just wont let me in.
I *CAN* edit any cell that was NULL in the db.
Once I enter a value in one of the NULL cells, that cell wont let me in a second time. :numbness:

By "wont let me in" I mean that the cell is unclickable once it has a non-NULL value (either from the db, or from edits I have made). Tabbing or arrowing skips non-NULL cells.

What have I misunderstood?

regards Chris
 
Fixed

There must have been some property or other "left over" from the formerly manually populated/harvested DGV.
Deleting the DGV from the form and adding a new DGV fixed it.

regards Chris
 
Back
Top