My application contains ListView
with files that i am handling and have 3 columns: file name, length and status.
Inside my for loop i am handling file after file and want in this case to change the status column from wait which is the value at the beginning to in process.
is it possible to change one column ?
lvFiles is my ListView
for (int i = 0; i < lvFiles.Items.Count; i++)
{
//here i am do things with my file
}
Here i am adding files into my ListView:
ListViewItem item = new ListViewItem(new string[] { new FileInfo(filePath).Name, duration, "Waiting" });
Use SubItems property of ListViewItem
:
foreach(ListViewItem item in lvFiles.Items)
item.SubItems[2].Text = "Waiting";
You can try something like this if you know the specific Column for example Address would be colString[2] you can do a single line
string[] colString = new string{ "Starting", "Paused", "Waiting" };
int colIndex = 0;
foreach (ColumnHeader lstViewCol in lvFiles.Columns)
{
lstViewCol.Text = colString[colIndex];
colIndex++;
}
for single column you stated you wanted the 3rd column then you could something like this
lvFiles.Colunns[2] = "waiting";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With