We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

DataRow of a DataGrid Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

2799 Feb 14,2003 02:21 AM Apr 23,2003 09:23 AM Windows Forms 4
loading
Tags: FAQ
Matthew Williams
Asked On February 14, 2003 02:21 AM

Is there a way of getting a reference to the DataRow in the Underlying DataTable of the selected DataGrid Cell. I was using the Row Number of the Cell, but when a row is deleted the Row Numbers do not match up. Any ideas??? Matt

Matthew Williams
Replied On February 17, 2003 01:42 AM

Please HELP I really need to know how to do this!!!!! Matt

jim
Replied On February 19, 2003 05:16 PM

look in the faq 5.67 and 5.29 might help.

Matthew Williams
Replied On March 5, 2003 01:47 AM

> look in the faq 5.67 and 5.29 might help. I thought that faq 5.67 would help but it still references the deleted record I'll give you a little background in what I am trying to do. I have a table containing VAT Codes and their vat rates: |VAT Code|VAT Rate| |--------|--------| |A | 0.5| |B | 0.6| |C | 0.7| I need to know what rows were added, deleted or edited. So I have called the: Me.dtVATCodes.AcceptChanges() method. As this only marks rows for deletion so that I can track the changes. The problem I am having is when I Delete the second row (B) and I use the method in faq 5.67: With objDG Dim bm As BindingManagerBase = .BindingContext(.DataSource, .DataMember) Return CType(bm.Current, DataRowView).Row End With when on the new second Row (C) I am referencing the deleted row. Am I doing something very silly or is there another way of doing this?? Thanks. Matt PS. I really need to get this done yesterday

Sameer
Replied On April 23, 2003 09:23 AM

I am giving it a shot, i dont know if this is REALLY ur problem, DataView currentView ; currentView = new DataView( [ur table from the DataSet goes here]) ; DataGrid dg = new DataGrid() ; dg.Source = currentView ; and then .... wherever u need to know ur row int index = dg.CurrentRowIndex ; DataRow dr ; DataRowView drv = currentView[index] ; dr = drv.Row; I hope this helps. -S > > look in the faq 5.67 and 5.29 might help. > > > I thought that faq 5.67 would help but it still references the deleted record > > I'll give you a little background in what I am trying to do. > > I have a table containing VAT Codes and their vat rates: > > |VAT Code|VAT Rate| > |--------|--------| > |A | 0.5| > |B | 0.6| > |C | 0.7| > > I need to know what rows were added, deleted or edited. So I have called the: > > Me.dtVATCodes.AcceptChanges() > > method. As this only marks rows for deletion so that I can track the changes. > > The problem I am having is when I Delete the second row (B) and I use the method in faq 5.67: > > With objDG > Dim bm As BindingManagerBase = .BindingContext(.DataSource, .DataMember) > Return CType(bm.Current, DataRowView).Row > End With > > when on the new second Row (C) I am referencing the deleted row. Am I doing something very silly or is there another way of doing this?? > > > Thanks. > > Matt > > PS. I really need to get this done yesterday

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;