In this tutorial, we will learn how to create and use a ListView control in VB.NET.We will also see how to create multiple views of ListView items.
Visual Basic Listview Tutorial How To Create AndThis article also covers most of the properties and methods of the ListView control. After you drag and drop a ListView onto a Form, the ListView looks like Figure 1. Once a ListView is on the Form, you can move it around and resize it using mouse and set its properties and events. Visual Basic Listview Tutorial Code Snippet CreatesThe following code snippet creates a ListView control object. The following code snippet sets location, width, height, background color, foreground color, Text, Name, and Font properties of a ListView. To do so, we use Form.Controls.Add method that adds ListView control to the Form controls and displays on the Form based on the location and size of the control. The following code snippet adds a ListView control to the current Form. You can open Properties window by pressing F4 or right click on a control and select Properties menu item. The following code snippet sets and gets the name and text of a ListView control. You may also use Left and Top properties to specify the location of a control from the left top corner of the Form. We can also use Width and Height property instead of Size property. The following code snippet sets Location, Width, and Height properties of a ListView control. If you click on the Font property in Properties window, you will see Font name, size and other font options. If you click on these properties in Properties window, the Color Dialog pops up. ![]() The BorderStyle property is represented by a BorderStyle enumeration that has three values FixedSingle, Fixed3D, and None. The following code snippet sets the border style of a ListView to FixedSingle. We can add items to a ListView at design-time from Properties Window by clicking on Items Collection as you can see in Figure 4. ![]() The following code snippet sets and gets current text of a ListView. The Sorting property sets the kind of sorting applies to the items and Sort method forces the sorting. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |