简体   繁体   中英

Format ListBox Items bound to a Datatable in C#

I have a Datatable with a field named "path" that stores full path of a file. I have bound the "path" field to a listbox. The listbox shows the full file path but I want to format the path so it only shows the file name instead of full file path yet remains bound with "path" field that has full file path stored. Is there any way to do it?

Any help would be appreciated.

The key here is value member and display member.

This might help: c# listBox DisplayMember

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