Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting an Item from a CListBox

Status
Not open for further replies.

LuisEnrique

Programmer
Nov 15, 2001
10
0
0
US
Hello Everybody:
I have a CListBox that displays a list of files. I want to extract the name(string) of the file that is selected in the inbox. What do I need to do to do that? Any answer ir more than welcome.

Regards,
Luis E. Cuadrado
 
Normally you would do something like this...

// Get the data of the selected item
I = m_List1.GetCurSel();

where m_List1 is the List box....

then -

// Get the string in a CString object
nTextLen = m_List1.GetTextLen( I );
m_List1.GetText( I, data.GetBuffer(nTextLen) );

Now you have the required data in (CString) "data".

HTH
Sarva


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top