Docsity

Windows Forms: ListView and DataGridView, Schemes and Mind Maps of Information Technology

Partial preview of the text

Download Windows Forms: ListView and DataGridView and more Schemes and Mind Maps Information Technology in PDF only on Docsity!

Programming

Lecture 13

Windows Form Part 4

Agenda

โ€ข ListView

โ€ข DataGridView

โ€ข Data Binding

ListView

Have 2 options to create ListView
  1. ListView in Design
  2. ListView in Run-time

ListView

ListView in Design

Toolbox -> search ListView and drag ListView to Form Design

ListView

ListView in Design

Change Text value -> Add to add item to ListView

ListView

ListView in Design

Result

ListView

โ— Set Bound โ— Set GridLines โ— Set Columns โ— Allow Column Reorder

Custom ListView

ListView

โ— ListView setData: using ListView.Items.AddRange (Array Object)

SetData ListView

ListView

ListView in Run-time

Set Data to ListView

ListView

ListView focused item

If want to set the item as focused when selecting an item in ListView

Question 1

How to: Add and Remove Items with the Windows Forms ListView Control โ— Describes how to add or remove items from a list view.

How to: Add Columns to the Windows Forms ListView Control โ— Describes how to create columns in order to display information about each list item.

How to: Display Icons for the Windows Forms ListView Control โ— Describes how to associate a list view with an appropriate image list for displaying large or small icons.

How to: Display Subitems in Columns with the Windows Forms ListView Control โ— Describes how to display information about each list item in columns.

Question 2

How to: Select an Item in the Windows Forms ListView Control โ— Describes how to programmatically select an item.

How to: Group Items in a Windows Forms ListView Control โ— Describes how to create groups for categorized display and how to assign items to each group.

How to: Enable Tile View in a Windows Forms ListView Control โ— Describes how to display items as tiles, each of which is comprised of a large icon and multiple lines of text.

DataGridView

โ— The DataGridView control provides a customizable table for displaying data.

โ— The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.

โ— Use a DataGridView control to display data with or without an underlying data source.

DataGridView Definition

DataGridView

โ— Without specifying a data source, you can create columns and rows that contain data and add them directly to the DataGridView using the Rows and Columns properties.

โ— Use the Rows collection to access DataGridViewRow objects and the DataGridViewRow.Cells property to read or write cell values directly.

โ— The Item[] indexer also provides direct access to cells.

DataGridView Definition