Solved

Adding a row in the listview from another form.

Posted on 2012-04-09
1
270 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now