Populating a listview on a Parent Form from a class file: Need Help! C#
Posted on 2003-03-28
Hi, I've searched everywhere for documentation but can't find a solution to my problem...
Lets say I have a listview on a Parent Form (frmMain.cs). I also have a file (clsSQL.cs) with methods to query a database. When frmMain.cs initializes, it calls a method in clsSQL.cs to query the database for a list of records. I want that list of records to directly be inserted into a listview box on frmMain.cs.
I have made the listview public and a when I try to add something to it from clsSQL.cs (frmMain.lvMsgList.Items.Add("test3");) I get an error:
* An object reference is requred for the nonstatic field, method, or property.
Can anyone provide an example on how I would do this or point me in the write direction on trying to populate data on a Parent Form from a class file?