I am loading from a database into a listView but I need to show the population progress while loading. Currently the data is displayed only after the loading is completed. This is what I have done so far, and thank you for any help:
string SQLCommand = "SELECT * FROM table";
using(SQLiteConnection con = new SQLiteConnection(connectionString))
{
con.Open();
using (SQLiteCommand cmd = new SQLiteCommand(SQLCommand, con))
{
using (SQLiteDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
var v1 = (rdr[3].ToString());
var v2 = (rdr[4].ToString());
var v3 = (rdr[5].ToString());
var v4 = (rdr[6].ToString());
ListViewItem item1 = new ListViewItem(v1);
item1.SubItems.Add(v4);
item1.SubItems.Add(v2);
item1.SubItems.Add(v3);
lvwDetails.Items.AddRange(new ListViewItem[] { item1 });
System.Threading.Thread.Sleep(2000);
}
}
}
}