开发者

edit ListView from C++ clr

开发者 https://www.devze.com 2022-12-08 00:01 出处:网络
I am facing some prob in managed C++,I can fill my ListView , but I am unable to edit specific row at later time

I am facing some prob in managed C++, I can fill my ListView , but I am unable to edit specific row at later time

I can fill like

listView1->View = View::Details;   
listView1->Columns->Add("S.no",......
ListViewItem^ itmp = gcnew System::Windows::Forms::ListViewItem("100");
ListViewSubItem^ itms1 = gcnew ListViewSubItem(itmp, "12:12:12 PM");
itmp->SubItems->Add(itms1);
listView1->Items->Add(itmp);

I want to implement following VB code in managed C++ , but showing errors

Dim FindlvItem()开发者_Python百科 As ListViewItem  // here i am facing problem in conversion to c++ managed
FindlvItem = Me.ListView1.Items.Find("100", False)
FindlvItem(0).SubItems(0).Text = "01:01:01 AM"

I dont want to use foreach loop to save processing

vs.net 2008


You should be able to convert the code almost line for line to C++/CLI. The only problem is that Find will return a collection of list view items, not just a single item.

array<ListViewItem^>^ FindlvItem = ListView1->Items->Find("100",false);
if (FindlvItem->Length == 1)
{
    FindlvItem[0]->SubItems[0]->Text = "01:01:01 AM";
} // if found
0

精彩评论

暂无评论...
验证码 换一张
取 消