Solved

Multiple Selection in a ListBox Control

Posted on 1997-08-09
4
607 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 171
WinWaitActive parameters 12 31
sumHeights2  challenge 7 138
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 549
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

739 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