?
Solved

Multiple Selection in a ListBox Control

Posted on 1997-08-09
4
Medium Priority
?
614 Views
Last Modified: 2013-11-19
I have a list box control in a dialog box, which is associated with  CPropertyPage class.I have selected "Multiple Selection".I have associated a CString variable for the listbox through class wizard.Now the prblem is, when ever I click the tab of the next property page (i.e On killing this property page), I see a crash.When I go through the debugger I come to know that the "LB_GETTEXTLEN" message is sent(in MFC's Source DLGDATA.CPP) an the return value is -1.Can any one help me to resolve the crash?
0
Comment
Question by:Amaresh080997
  • 2
4 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1303455
What version of VC++ are you using ?
0
 

Author Comment

by:Amaresh080997
ID: 1303456
Thanks for replying mbhakta! I am using MFC 4.2.Can u suggest me something?
0
 
LVL 1

Accepted Solution

by:
cnasarre earned 0 total points
ID: 1303457
I'm almost sure that you can't handle a multi-select listbox
with a CString. The data exchange process is not implemented.
You have to do it yourself either in DoDataExchange() or
in OnKillActive()/OnSetActive() of your property page.

You have to use GetSelCount() and GetSelItem() to get each
selected item and store them in a list or whatever you need

0
 

Author Comment

by:Amaresh080997
ID: 1303458
Thanks for the reply cnasarre! Your answer is certainly acceptable.It is the same thing even I thought of.But I was not sure.
By the way, I still leave the question open for answering so that some one who is doubly sure can give it a shot.
Once again thanks a lot for replying cnasarre!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question