|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DatagridviewHi all,
Is there a way to retrieve the rowstate of a row in a datagridview (added - modified - deleted - ...) ? Does someone have some info on this or a document/url where I can read about it? Thanks in advance! Philipp You're confusing a DataGridViewRow with the underlying data source. A
DataGridViewRow does not have any such properties. A System.Data.DataRow does. But you need to confirm to us that your DataGridView is bound to a table first. If so, the DataGridViewRow has a "DataBoundItem" property which is of type "object." If it is bound to a DataTable, the DataBoundItem property will be a DataRowView (most likely). A DataRowView has a "Row" property which is the underlying DataRow. And *that* has a RowState property. -- Show quoteHTH, Kevin Spencer Microsoft MVP Professional Numbskull The man who questions opinions is wise. The man who quarrels with facts is a fool. "Philipp" <sty***@hotmail.invalid.com> wrote in message news:uLAkPCdfGHA.3652@TK2MSFTNGP02.phx.gbl... > Hi all, > > Is there a way to retrieve the rowstate of a row in a datagridview > (added - modified - deleted - ...) ? > Does someone have some info on this or a document/url where I can read > about it? > > Thanks in advance! > > Philipp Kevin Spencer wrote:
> You're confusing a DataGridViewRow with the underlying data source. A Thanks!> DataGridViewRow does not have any such properties. A System.Data.DataRow > does. But you need to confirm to us that your DataGridView is bound to a > table first. If so, the DataGridViewRow has a "DataBoundItem" property which > is of type "object." If it is bound to a DataTable, the DataBoundItem > property will be a DataRowView (most likely). A DataRowView has a "Row" > property which is the underlying DataRow. And *that* has a RowState > property. > The DataGridView is indeed bound to a DataTable. I will try this when I'm back at work in a couple of days. Thanks for the answer, I'll let you know if it works! Philipp
Show quote
"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> schreef in bericht It is exactly as you describe ... the only problem is that when the news:O11ipjefGHA.2068@TK2MSFTNGP02.phx.gbl... > You're confusing a DataGridViewRow with the underlying data source. A > DataGridViewRow does not have any such properties. A System.Data.DataRow > does. But you need to confirm to us that your DataGridView is bound to a > table first. If so, the DataGridViewRow has a "DataBoundItem" property > which is of type "object." If it is bound to a DataTable, the > DataBoundItem property will be a DataRowView (most likely). A DataRowView > has a "Row" property which is the underlying DataRow. And *that* has a > RowState property. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > Professional Numbskull datagridview is bound, the rowstate of all datarows are of type "added". When something is changed in the DataGridView the state of the underlying row still is "added". Am I doing something wrong here ? Thanks Greets, Philipp |
|||||||||||||||||||||||