Deletion of a string from List Box in MFC
Posted Date Unknown stephin Francis Antony 2 Comments

I have a list box that contain following strings
book for C
when I remove a particular string using following code 

int iSelCount=Listboxcntrl.FindString(0,book);

it removed the first item that contain the word book
it removed the word book for C. I want to remove exactly book. Can anybody help?

See All Responses Below...
Message Rating
Posted on: 03/03/2014

Do it like this..

Iterate form last to fist using for loop
1. Check whether each item is selected.
2. get the LtstBox item text using GetLBText
3. If it matches, remove it..

Posted on: 03/03/2014
Thank you..

But I got the answer by FindStringExact() method

int iSelCount=Listboxcntrl.FindStringExact(0,book);

Share this page across other social networking sites

Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site.