web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Using .net ListView in x++ form

(0) ShareShare
ReportReport
Posted on by 517

Hi all, I want to use the .Net ListView in AX2012 form via managed host control.

The problem is it tells the declaration below is "syntax error":

System.Windows.Forms.ListView.ListViewItemCollection listItems;

I need this listItems variable to add item into the list view like:

listItems = listview_control.get_Items();

listItems.add(new ListViewItem('xxx'));

It seems X++ does not recognize System.Windows.Forms.ListView.ListViewItemCollection.

Any one know the solution?

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    It's a nested class, isn't it? I suspect they're not supported by .NET Interop from X++.

    As a workaround, you could declare listItems as System.Collections.IList.

    Or create a custom control extending ListView and provide methods that are easier to consume from X++.

  • Xin Duan Profile Picture
    517 on at

    yes, ListView.ListViewItemCollection is a nested class. I tried System.Collections.IList. It works. I may wrap it with custom class later.

    Thanks Martin!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans