Solved

Multiple Selection in a ListBox Control

Posted on 1997-08-09
4
606 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 66
format the code in java 6 109
conditional code and condition difference 9 84
countEvens challenge 2 113
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

763 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