Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / November 2005

Tip: Looking for answers? Try searching our database.

Accessing data in AddNew row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RRB - 20 Nov 2005 02:24 GMT
Hi,

I have a datagrid with some columns that cause recalculation of values
in controls elsewhere on my form.  These recalculations need to occur
when these datagrid cells have changed (I tied to the Validated event).
This is also true for the AddNew row.

My recalculation method currently recalculates by iterating through the
rows of the datagrid.  The problem is that the AddNew row is not yet
added, so the relevant cells aren't included in the calculations.

I therefore need to find a way to access the commited values in the
AddNew row.  I looked in the CurrencyManager but didn't find a reference
to the row. Where can I find a reference to this row?

Thanks in advance!

RRB

======================

blackbox testing prerequisites:
1 white box
1 black marker
Bart Mermuys - 20 Nov 2005 10:58 GMT
Hi,

> Hi,
>
[quoted text clipped - 10 lines]
> AddNew row.  I looked in the CurrencyManager but didn't find a reference
> to the row. Where can I find a reference to this row?

Even when you bind the DataGrid to a DataTable or DataSet it is always
internally bound to a DataView.  The DataView includes the new row even when
it hasn't been accepted yet so it can still disappear when the user cancels
the new row.

CurrencyManager cm = (CurrencyManager)
 dataGrid1.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];

DataView dv = (DataView)cm.List;

foreach ( DataRowView drv in dv )
  Console.WriteLine( drv["columnName -or- index"] );

Note that DataView also has an event called ListChanged which may be usefull
to you...

HTH,
Greetings

> Thanks in advance!
>
[quoted text clipped - 7 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
RRB - 29 Nov 2005 15:09 GMT
Hi Bart,

I got sidetracked by some other issues so I'm only just getting back to
this issue. Thanks for your reply, the List property is exactly what I
need.

Thanks again,
RRB

======================

blackbox testing prerequisites:
1 white box
1 black marker

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.