How To Unload A List

Table of contents:

How To Unload A List
How To Unload A List

Video: How To Unload A List

Video: How To Unload A List
Video: Delete a node from Doubly Linked List(start / middle/ end node) 2024, December
Anonim

User interface development in most programming environments involves working with windows. Including filling in the fields of the window form, which is usually done by loading a predefined list of data into the element. The list can be stored statically in an array or generated dynamically during program execution. Methods for unloading information into a window element differ when creating a program in different development environments.

How to unload a list
How to unload a list

Instructions

Step 1

In Visual Basic, a list is an array of strings that can be referenced using the List property, a list of strings in the control. All window elements, to which you can add string information, have a similar property. To unload data into a combo box element, use the following construction: lstMyList. AddItem (“First instance”), where lstMyList is the name of the combo box object, AddItem is the method for adding a string with information contained in brackets and quotes (“”). When adding the entire list stored in the array to the element, the program code will look like this: Dim MasSp (10) As String // declaration of an array for 10 lines Dim i As LongFor i = 1 To 10 // loop for adding lines lstMyList. AddItem MasSp (i) Next i This loop fills the lstMyList window element with a list of 10 lines contained in the MasSp array.

Step 2

The Delphi environment provides the ability to handle window elements also through an object and specifying a property of a specific component. The syntax of the Pascal language used in this case allows you to unload the list by setting a loop. Implement sequential addition of lines from the list in a similar way to the presented code: var MasSp: array [1..10] of String; k: Integer; for k: = 1 to 10 doListBoxMy. Items. Add (MasSp [k]); Here ListBoxMy is the name of the window item object, Items is a property that provides access to strings, Add is a method that adds strings from the MasSp array to component.

Step 3

When programming in the popular Qt environment, the principle of accessing window elements is similar, the only differences are in the syntax of the C ++ language used. To upload data to the fields of drop-down or regular lists, access the elements. Then use one of the row adding functions, for example, the insertItem method is implemented for QcomboBox and QListBox. With its help, you can gradually fill an element with strings in a loop: QString MasSp; for (int i = 0; i

Recommended: