2.2.6.19.8 ListBox::GetSel

Description

Syntax

int GetSel( int nIndex )

Parameters

nIndex

Return

A positive number if the specified item is selected; otherwise, it is 0. The return value is LB_ERR if an error occurs.

Examples

EX1

#include <..\OriginLab\DialogEx.h>   // Dialog class
#define IDC_LIST1 1001

void ListBox_GetSel(Dialog& MyDlg)
{
	ListBox  m_List = MyDlg.GetItem(IDC_LIST1);    
	string str;
	for( int i = 0; i < m_List.GetCount(); i++ )
	{
		str.Format(("item %d: select state is %s\r\n"), i, m_List.GetSel( i ) > 0 ? "true" : "false");
		out_str(str);
	}
}

Remark

See Also

Header to Include

Control.h