If you can read data properly from database then just in the form load or constructor
of the form class write following line:
//here dbClass is an instance of your database class
List<String> rooms = dbClass.displayRoom(); //though `get/load rooms()` would be more appropriate
foreach (string s in rooms)
{
ListViewItem lv=new ListViewItem(s);
listView1.Items.Add(lv); //listView1 is the ListView instance in your form
}
EDIT
If your Form
has name Form
, then either in Form1_Load(object sender, EventArgs e)
or in public Form1()
constructor (after InitializeComponent
is called), you can put the above code.