c# - Load/Edit and Save XML Data on a different form -
at moment have application looks this:
it reads data xml file dataset, , sets datasource fit datagrid
when user clicks on row, data within notes section displayed within textbox below
when user clicks notes button brought new form, form2, data notes textbox brought across new textbox. want able able enter new text notes textbox on form 2 , when user clicks ok saves datagrid
exactly this: http://youtu.be/mdmjmobrcsk?t=28m41s
the code have @ moment ok button far below, , following error because haven't wrote datagridview1 on form.
i'd know how user input textbox , 'update' xml file datagrid updated new notes
i'm not sure if code how have linked datagridview1_cellcontentclick textbox below on form1, think need reuse last line on new form overwrite data i'm not sure
if (e.rowindex >= 0) { datagridviewrow row = this.datagridview1.rows[e.rowindex]; //the data in cells notes column turns string , copied textbox below textbox1.text = row.cells["somenotes"].value.tostring();
thank help!
i think problem related contacting between forms (a basic problem). should treat form2 dialog, in form1, show this:
//textbox1 on form1 if(form2.showdialog(textbox1.text) == dialogresult.ok){ datagridview1.rows[datagridview1.currentcelladdress.y].cells["somenotes"].value = form2.notes; //perform update xml //..... } //your form2 public class form2 : form { public form2(){ initializecomponent(); } public string notes {get;set;} public dialogresult showdialog(string inittext){ //suppose textbox on form2. textbox.text = inittext; return showdialog(); } private void okbutton_click(object sender, eventargs e){ notes = textbox.text; dialogresult = dialogresult.ok; } private void cancelbutton_click(object sender, eventargs e){ dialogresult = dialogresult.cancel; } } //form2 defined in form1 class.
Comments
Post a Comment