Click here to Skip to main content
15,917,709 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get access to an object during runtime from its process Pin
Heath Stewart10-Jan-05 20:01
protectorHeath Stewart10-Jan-05 20:01 
GeneralRe: Get access to an object during runtime from its process Pin
Dany McCarthy11-Jan-05 14:50
Dany McCarthy11-Jan-05 14:50 
GeneralStock Market Simulation Pin
8raker10-Jan-05 13:00
8raker10-Jan-05 13:00 
GeneralRe: Stock Market Simulation Pin
Colin Angus Mackay10-Jan-05 13:46
Colin Angus Mackay10-Jan-05 13:46 
GeneralRe: Stock Market Simulation Pin
8raker11-Jan-05 1:17
8raker11-Jan-05 1:17 
GeneralRe: Stock Market Simulation Pin
Colin Angus Mackay11-Jan-05 1:52
Colin Angus Mackay11-Jan-05 1:52 
GeneralSyncronize Windows Forms DataGrid with DataSet Pin
epinaud10-Jan-05 11:01
epinaud10-Jan-05 11:01 
GeneralRe: Syncronize Windows Forms DataGrid with DataSet Pin
Heath Stewart10-Jan-05 19:54
protectorHeath Stewart10-Jan-05 19:54 
This has been covered many, many times in this forum. Click "Search comments" above this forum and search for "DataGrid DataSet".

Also see the .NET Framework SDK for the SqlDataAdapter.Update and Fill methods. The documentation for the DataGrid.DataSource and DataMember properties also contain examples and other information about binding a DataSet to a DataGrid.

To find the record of the new row is possible in many ways. The DataSet keeps track of changes (so never call DataSet.AcceptChanges before SqlDataAdapter.Update, otherwise no changed information is found and the database is not updated), so you can enumerate the rows and find the newest row. A more efficient way is to handle the DataTable.RowChanged event for the DataTable within the DataSet that you've bound to. In your event handler, you check the DataRowChangedEventArgs.Action for DataRowAction.Added. If that is the case, the DataRowChangedEventArgs.Row is the DataRow that was just added to the DataTable.

You should also keep in mind that if you allow sorting in your DataGrid, the select row visually may not actually be the nth row in the DataTable. For that, you use a CurrencyManager. This is because what the view in the DataGrid is is only a view; the data is unchanged in the DataTable. If you click "Search comments" and search for "CurrencyManager" you can find many topics covering this problem as well.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
Generalproblem in opening a web application project Pin
panky_710-Jan-05 10:56
panky_710-Jan-05 10:56 
GeneralRe: problem in opening a web application project Pin
panky_710-Jan-05 12:02
panky_710-Jan-05 12:02 
GeneralRe: problem in opening a web application project Pin
Heath Stewart10-Jan-05 20:03
protectorHeath Stewart10-Jan-05 20:03 
GeneralRe: Missing / searching 2nd DataItem as independant index in list/combobox Pin
Rob Graham10-Jan-05 10:56
Rob Graham10-Jan-05 10:56 
GeneralDeleting a Row from a DataSet in a DataGrid Pin
joschmo8010-Jan-05 9:08
joschmo8010-Jan-05 9:08 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
DougW4810-Jan-05 15:36
DougW4810-Jan-05 15:36 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
Heath Stewart10-Jan-05 20:09
protectorHeath Stewart10-Jan-05 20:09 
GeneralRe: Deleting a Row from a DataSet in a DataGrid Pin
joschmo8011-Jan-05 1:56
joschmo8011-Jan-05 1:56 
GeneralAccess Security for window based Pin
caheo10-Jan-05 8:48
caheo10-Jan-05 8:48 
GeneralRe: Access Security for window based Pin
Heath Stewart10-Jan-05 20:14
protectorHeath Stewart10-Jan-05 20:14 
QuestionHow to create a typed DataSet at run-time without type definition files (.xsd or .dtd)? Pin
huckfinn10-Jan-05 7:30
huckfinn10-Jan-05 7:30 
Generalcomparing arrays Pin
sciamachy10-Jan-05 6:50
sciamachy10-Jan-05 6:50 
GeneralRe: comparing arrays Pin
Judah Gabriel Himango10-Jan-05 8:01
sponsorJudah Gabriel Himango10-Jan-05 8:01 
QuestionCan I use webservice to download a file to my local app? Pin
Joshscorp10-Jan-05 6:46
Joshscorp10-Jan-05 6:46 
AnswerRe: Can I use webservice to download a file to my local app? Pin
Judah Gabriel Himango10-Jan-05 8:06
sponsorJudah Gabriel Himango10-Jan-05 8:06 
GeneralRe: Can I use webservice to download a file to my local app? Pin
Joshscorp10-Jan-05 12:44
Joshscorp10-Jan-05 12:44 
GeneralRe: Can I use webservice to download a file to my local app? Pin
Judah Gabriel Himango11-Jan-05 3:56
sponsorJudah Gabriel Himango11-Jan-05 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.