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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting contents of a selected line in a list box 1

Status
Not open for further replies.

cluelessC

Programmer
Jul 20, 2001
10
GB
Hello, everyone! :)

Does anybody know what the equivalent of a 'GetLine' function in respect of List Boxes is? If I have the index of the selected line, how do I get its contents? The 'DlgDirSelect' does not seem to work... :-(

Well, I am not really dealing with directories anyway, so, what other function CAN I use? Would be most grateful for any advice!!!
 
Use :

CString cStr ;
MyList.GetText(MyList.GetCurSel(), &cStr) ;

HTH

:)
William
Software Engineer
ICQ No. 56047340
 
Thank you very much, William, and for those wishing to use the text from the selected line in the list box, please, note that the address reference might give you a type mismatch error. This is how I used the code (to check if the string was actually seen):

CString str;
m_MyList.GetText(m_MyList.GetCurSel(), str);
m_MyEdit.SetWindowText(str); //just to c(it)out<<...

Cheers for your help, matey, have a nice day! :)
 
I used the AddressOf operator out of force of habit!

Sorry.

William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top