How can I pass a listview from one form to another form? -


i have 2 forms. form1 , form2. there button @ form1 me access form2 , in form2, have listview2 , textboxes. manage input items listview2. when click on ok button in form2, listview1 in form1 should show listview2. guys, can suggest me way this? thanks

below codes. hope don't confuse all.

form1 code =>

namespace mainserverpage 

{ public partial class mainserverpage : form { public listview lv;
public mainserverpage() { initializecomponent(); }

    private void btnadd_click(object sender, eventargs e)     {         additem add = new additem(this);                //to open form2         add.showdialog();     }  } 

}

form2 code =>

namespace mainserverpage 

{ public partial class additem : form { mainserverpage currentform; //i learn way of passing form it's not working public additem(mainserverpage incomingform) { currentform = incomingform; initializecomponent(); }

    private void btnupdate_click(object sender, eventargs e)     {         listviewitem item = new listviewitem(txtcode.text);         item.subitems.add(txtlocation.text);         item.subitems.add(cbxstatus.text);         item.subitems.add(txtweatherhigh.tostring());         item.subitems.add(txtweatherlow.tostring());                     listview2.items.add(item);      //send listview2          txtcode.text = "";         txtlocation.text = "";         cbxstatus.text = "";         txtweatherhigh.text = "";         txtweatherlow.text = "";         cbxzone.text = "";                           }      private void btnok_click(object sender, eventargs e)     {          currentform.lv = load;    //i got stuck here...do not know     } } 

}

in general, it's not list view want pass, it's data list view representing. should rethink design such btnupdate_click function builds data object rather building listviewitem directly. can either pass data object(s) first form.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -