ToIdx Method

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 17:09

Description

In a combo array, selects an item by its value, and not by index.

Returns the index of the selected item.

Syntax

object.ToIdx(lngItemData)

object

Required. Object name, returned by Dim idlg As InputDlg = New InputDlg.

lngItemData

Item value.

Example

In this example, the item with the value 789 gets preselected when the combo is displayed.

Dim idlg As InputDlg = New InputDlg

idlg.Title = "My title"

Dim combo As InputDlg.Combo = New InputDlg.Combo

combo.AddItem("Above", 456)

combo.AddItem("Below", 789)

Dim po = idlg.AddCombo("Position", combo, combo.ToIdx(789))

If idlg.ShowDialog Then                         ' if OK was clicked...

  MsgBox(idlg.GetComboData(po))                 ' return the value of selected item

End If