I have 3 forms. Lets call them Main, UserInput, and ListViewForm.
I add data to a list on Main using the data from UserInput. The List is used to manage a TextBox that shows the total items added. That List needs to have the same contents as the ListView on ListViewForm. So if the TextBox shows 5, the ListView needs to have those 5 items. I know how to add items straight to a ListView with 2 forms, but in this case, I am using 3. What I believe needs to be done is to add the items to the List and ListView at the same time in my Add Button Event in InputForm.
On ListViewForm, If I am using UserInput ui = sender as UserInput
, I need to be able to trigger an Event that will run the Method in ListView. That event is my Add Button in UserInput, but I have no access on that form to direct the EventHandler to subscribe to ListViewForm.
Heres the Method on ListViewForm
public void addToListView(object sender, EventArgs e)
{
//Method to Add to ListView
userInputForm listItems = sender as userInputForm;
//listItems.ItemNumChange += addToListView;
Person c = listItems.dataInfo;
ListViewItem lfi = new ListViewItem();
lfi.Text = listItems.dataInfo.Name;
lfi.Tag = c;
listView1.Items.Add(lfi);
}
Add an EventHandler to your form.