none
Has the DataGridView the property "View" like ListView? RRS feed

  • Question

  • I want to use DataGridView to replace ListView because DataGridView has more good features, for example hide row, set row spacing.., but i do not know if DataGridView has the "View" property like ListView. I want to show data using "LargeIcon", "Details", "List", "SmallIcon" mode in the DataGridView, can i do that? 
    Friday, August 25, 2017 1:31 AM

Answers

  • Yes, i know to add the imageColumn, but how to realize the view property? are there some sample? 
     Again,  the DGV does not have a "View" property and is set up much different than a ListView.  It would take a lot of work to implement the 5 Views that a ListView has and to get it to switch between them.

    If you say it can`t be done then i`ll try it


    • Edited by IronRazerz Friday, August 25, 2017 10:11 PM
    • Marked as answer by gaxjyxq Saturday, August 26, 2017 12:02 AM
    Friday, August 25, 2017 10:07 PM

All replies

  • There is no view property for a DataGridView. You would need to create a custom DataGridView or tweak properties of the DataGridView to get a similar look and feel.

    To mimic Large icon use a DataGridViewImageColumn.

    Going this route as per above will require a bit of code.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Proposed as answer by Frank L. Smith Friday, August 25, 2017 2:05 AM
    Friday, August 25, 2017 1:51 AM
    Moderator
  • Hi gaxjyxq,

    The DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. When you want your Windows Forms application to display tabular data, consider using the DataGridView control before others If you are displaying a small grid of read-only values, or if you are enabling a user to edit a table with millions of records, the DataGridView control will provide you with a readily programmable, memory-efficient solution. 

    If you want to add some image, you can set datagridview column as datagridviewimagecolumn, like this:

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 25, 2017 6:30 AM
    Moderator
  • Yes, i know to add the imageColumn, but how to realize the view property? are there some sample? 
    Friday, August 25, 2017 12:16 PM
  • Hi gaxjyxq,

    The DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. When you want your Windows Forms application to display tabular data, consider using the DataGridView control before others If you are displaying a small grid of read-only values, or if you are enabling a user to edit a table with millions of records, the DataGridView control will provide you with a readily programmable, memory-efficient solution. 


    Cherry,

    I think this is new to us all. Can you give a sample of a DataGridView presentation in the same way as with a Listview. 

    I think it will be beneficial to all developers with Visual Studio Net.


    Success
    Cor


    Friday, August 25, 2017 1:36 PM
  • Yes, i know to add the imageColumn, but how to realize the view property? are there some sample? 

    Show a couple images of what you want to achieve. Your idea of "view property" may not the same as mine. Show an image of the listview you want to replace with a dgv.

    Friday, August 25, 2017 2:01 PM
  • Yes, i know to add the imageColumn, but how to realize the view property? are there some sample? 
     Again,  the DGV does not have a "View" property and is set up much different than a ListView.  It would take a lot of work to implement the 5 Views that a ListView has and to get it to switch between them.

    If you say it can`t be done then i`ll try it


    • Edited by IronRazerz Friday, August 25, 2017 10:11 PM
    • Marked as answer by gaxjyxq Saturday, August 26, 2017 12:02 AM
    Friday, August 25, 2017 10:07 PM