Solved

Adding a row in the listview from another form.

Posted on 2012-04-09
1
271 Views
Last Modified: 2012-06-21
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:

        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;
            }

Open in new window


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
0
Comment
Question by:peterkiers
1 Comment
 
LVL 17

Accepted Solution

by:
Anuroopsundd earned 500 total points
ID: 37822653
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question