Delphi's ListView component is located on the Win32 page of the component board. It can use 4 graphic methods (large icon, small icon, list, detailed list) to describe the option content, similar to "My Computer" in the Windows operating system, data item graphics Saved in ImageList component.
1.ListView main properties
(1) ViewStyle property
The ViewStyle attribute is used to select four display methods of data items, so this attribute has four option values: vsIcon large icon, vsSmallIcon small icon, vsList list, vsReport detailed list.
(2) Items attribute
The Items property is used to represent the data items of the ListView component, and the data items can be entered using the Items property editor. There are three buttons in the Items editor: NewItem, NewSubItem, and Delete, which are used to add data items, data item sub-items, and delete data items respectively.
Readers should note that the ListView component and the TreeView component are different in the way of displaying data items. When the Listview component works in vsIcon large icon, vsSmallIcon small icon, vsList list mode, only the first layer of data items is displayed without displaying the sub-number. Write it in the following line:
Dim MyName As string:MyName一"张三"
If after typing a line of code and pressing the Enter key, the line of code displays in red text (and possibly an error message at the same time), you must find the error in the statement and correct it.
2. Comment statement
In order to enhance the readability of the program, comments can be added to the program. Comments can explain procedures or certain commands. VBA ignores comments when running a procedure.
In VBA programs, comments can be implemented in two ways. The common method now is to use a single quote ('), or you can use Rem followed by a space as the beginning of the comment. For example:
Dim MyStrl.MyStr2MyStrl="htllo/":Ren Comments should be separated by colons after statements. MyStr2="(Goodbye/"'This is also a comment, no need to use colon.
Comments can be added anywhere in the process and appear in green text by default.
3. Declaration statement
Declarations can be used to name and define procedures, variables, arrays, and constants. When these program components are declared, their scope is also defined, and their scope depends on where they are declared and what keywords are used to declare them. For example, in the program section:
Sub ApplyFormat()Const limit As Integer 33Dim myCelI As Range
4. More statements
In End Sub, the Sub statement (matching the End Sub statement) declares a procedure named ApplyF0rmat. When this procedure is called or run, all statements contained in sub and End Sub will be executed. The Const statement declares the constant limit, specifying it as Integet' type, and its value is 33; the dim statement declares the variable mycell. This is a data type belonging to the Excel Range object. Variables can be declared as any object within the application being used.
The Dim statement is one of the statements used to declare variables. Other keywords used for declaration are: static, Public, Private and const.