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.
Elsewhere: Friend CurrentCase as oCase = New oCase and SQL-Server stored procedure ---> DataReader ---> CurrentCase.myDTCode: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
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.
So on with the DGV binding experiment
Comment out the populate/harvest and try:
dgvCaseInfo.Datasource = CurrentCase.myDT
dgvCaseInfo is populated as desired
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.
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


LinkBack URL
About LinkBacks






Reply With Quote


Bookmarks