Hi I was wondering if there was anyway to select and highlight new data automatically in listview. Currently I can load data into the listview from an ERP using their API acces token. Select manually and Save to my database.
What I want to do is following:
When the form loads, list everything from the EPR. This is accomplished.
Select a row in the listview then press a button to save into database. This is accomplished.
Instead of selecting a single row manually, select the new users added. This is where I have issues.
I do not know if it is even possible what i am trying to do. I have tried to do is select all and save everything into the database. This is possible but the Database will keep getting duplicates every time the form is loaded.
foreach (ListViewItem item in listView1.Items)
{
item.Selected = true;
//This method inserts each row(item) in the database
updateAll(object sender, EventArgs e);
}
I have selected all items to true and called updateAll(object sender, EventArgs e). The updateAll(object sender, EventArgs e) will select the first row, update it and put it in the database. How do I ensure that updateAll(object sender, EventArgs e) goes to the next item in the row and invokes updateAll(object sender, EventArgs e) on that?
My method works for single selected item and does what I want though just can't get it to work for all the items in the listview.