简体   繁体   中英

How to display the ContactItems Firstname in a ListBox

I got a list of Outlook Contacts and want to display them in a ListBox. This is the code I use to add every Contact to the ListBox but

foreach (ContactItem contact in contactItemsList)
            {
                ListBox_contacts.Items.Add(contact);
            }

The problem I have is with the output of the ListBox. Rather than showing the FirstName of each Contact it shows only: System.__ComObject

I read some things with overriding the ToString()- method but wasn´t able to understand how I should do that.

刚刚怎么样

ListBox_contacts.Items.Add(contact.Firstname);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM