Rin Yamazaki

Rin Yamazaki

  • NA
  • 1
  • 1k

How to transfer items from form1 listview to form2 listview?

Sep 6 2015 10:37 AM
okay, this is my problem for weeks and i hope you guys can help me. 
i have two forms, one is for customer order form and one is for the cashier form.
in the cashier form, it has an order and transaction(the one who can only compute the items is this part).
and in the customer form i have a order form (list of all the items) and the viewing form(all the items that is clicked will transfer here)
i want the items in the viewing form of customer form to be transferred into cashier's form and only on the "transaction" part.
only the cashier will do the items computing, i got the codes and it actually work.. but only one item can be transfer into the listview, and sometimes when i run the cashier form only.. it doesn't work. if i take off the passing codes in the customer form to cashier form.. of course the customer form won't work, but the cashier works. 
i already finished the cashier but now the customer form is my main problem.
 
 and here is the code i see for passing the items from customer form to cashier form
 
CASHIER FORM: 
this goes to form load.
 
 
ListViewItem ab = new ListViewItem(n1);
 ab.SubItems.Add(n2);
  ab.SubItems.Add(n3);
  ab.SubItems.Add(n4);
transaction_lv.Items.Add(ab);
 
this is the declarations on the top of the cashier form
 
public static string n1, n2, n3, n4;
 
CUSTOMER FORM:
this goes to the send button
 
 
frm_cashier.n1 = viewing_lv.Items[0].Text;
                frm_cashier.n2 = viewing_lv.Items[0].SubItems[1].Text;
                frm_cashier.n3 = viewing_lv.Items[0].SubItems[2].Text;
                frm_cashier.n4 = viewing_lv.Items[0].SubItems[3].Text;
 
i only have 4 items on the viewing part.
productid
productname
price
quantity
 
and its the same as the transaction part.
 
i hope you guys can help me. thanks in advance on those who will answer. 
 
 
 
 
 

Answers (1)