c# - Passing Data in Datagrid between Two Forms -
i have 2 forms form1 , form2. have 2 fields file name ,file path , button when clicked takes form 2 . form 2 has datagrid has file name , file path , ok button.if row in form1 has file path , file name should populated in form 2 , if manipulate data in form2 , click ok button, data should updated in form 1. since new c# finding bit difficult do. can please provide me pointers on how tackle problem
the crude (and not recommended) way make 2 data grid views 'public'. then, when exit cell on 1 data grid check see if it's 'dirty', , if process update both grids. if 1 form launched other, 1 update read this.parentform.dgfilenames.rows.... , other this.frmsubordinate.dgfilenames.rows...
a better approach have public methods on both forms, , invoke other form's corresponding update method each time rows on 1 grid updated.
realistically, each form should have user defined events adds , updates defined invoke other form's methods. presumes both forms open in situations updates entered in grids. involves defining interface , base class eventdata passed through events.
Comments
Post a Comment