Click here to Skip to main content
15,888,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two form form 1 and form 2 ,and i hav two listview one on each form same...on adding values in listview in form 1 on other button click it should show same values in form 2 liatview...how can dat b possible..plz guide me
Posted

Hi,

Here is what you can try :

1. Add the item in form1 listview and add same item in array or List<>.
2. On other button click put the form2 show code and on form2 load event write code to add items from array or List<> in form2 listview.
 
Share this answer
 
You can pass array of values from form 1 to from 2.
Declare a List property in form 2 i.e
C#
List<string> ListValues{get;set;}</string>

then on button click event you can set values from form 1 i.e
C#
private void onButtonClick(){
List<string> values=new List<string>();
foreach(string value in listofform1.items)
{
values.Add(value);
}
form2 objform2=new form2();
objform2.ListValues=values;
objform2.Show();
}
</string></string>

and on load event of form2 you can fill values from ListValues to listview.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900