Peter Kiers
asked on
Adding a row in the listview from another form.
Hi,
I am using C# and i programm in VS2010.
I have a mainform with a listview called lvNotes on it, and a second form called stickynotes.
After closing the stickynotes form I want to create a row in the listview on the mainform.
This is what I have:
But I don't know how to create a row in the listview from the StickyNotes form!
I get error:
The name 'lvNotes' does not exist in the current context
Who can help me?
Peter Kiers
I am using C# and i programm in VS2010.
I have a mainform with a listview called lvNotes on it, and a second form called stickynotes.
After closing the stickynotes form I want to create a row in the listview on the mainform.
This is what I have:
private void StickyNotes_FormClosed(object sender, FormClosedEventArgs e)
{
ListViewItem myItem = new ListViewItem(lblTitle.Text, 0);
myItem = lvNotes.Items.Add(myItem); <=====================
myItem.SubItems.Add(rtbContent.Text);
myItem.SubItems.Add(lblCreation.Text);
myItem.Selected = true;
}
But I don't know how to create a row in the listview from the StickyNotes form!
I get error:
The name 'lvNotes' does not exist in the current context
Who can help me?
Peter Kiers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.