PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Limitations
  • List Box control based on a data file
  • Last element
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the number of elements in a List Box, ListView or Combo Box control.
Remark: ListCount can be used on:
  • List Box controls based on a data file or populated programmatically,
  • single-selection or multi-selection List Box controls.
Example
// Number of elements found in the "LIST_CustomerList" control
ResNumberElements = ListCount(LIST_CustomerList)
Syntax
<Result> = ListCount(<List Box control>)
<Result>: Integer
Number of elements (rows) found in the specified control.
<List Box control>: Control name
Name of the List Box or Combo Box control to be used. If this parameter corresponds to an empty string (""), the control to which the current process belongs will be used.
Remarks

Limitations

If the specified List Box or Combo Box control is linked to a data file that contains more than 2,147,483,647 records, the returned value is truncated to this value.
WINDEVUniversal Windows 10 AppJavaUser code (UMC)

List Box control based on a data file

For a List Box control based on a data file, ListCount returns:
  • the total number of records found in the linked file if no filter was defined.
  • the number of records matching the filter if a filter was defined.
  • the number of records found in the query linked to the control.
The end of initialization code of control is run once the total is calculated.

Caution: The time for calculating the number of records can be quite long

Last element

To position on the last element of List Box control, use the following syntax:
ListSelectPlus(<List Box control>, <List Box control>.Count)
or
<List Box control> = <List Box control>.Count
or
<List Box control> = ListCount(<List Box control>)

Miscellaneous

  • To find out the number of rows in a Table control, use TableCount.
  • ListCount can be used on a "Combo Box" table column.
Component: wd270obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo Listbox - quantos clientes tem
// Elimina dados do Listbox
ListDeleteAll(LISTE_programa)
// Ler a tabela de clientes e preenche ListBox
FOR EACH cliente
ListAdd(LISTE_programa,cliente.nome)
END
//Verifica quantos tem no ListBox
n_quantos is int = ListCount(LISTE_programa)
//Mostrando mensagem
Info("Tem "+n_quantos+" clientes")

//Blog com Video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/04/curso-windev-listbox-003-listcount.html
De matos AMARILDO
17 Apr. 2016