[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Choosing names from  list box in Visual C++

Posted on 2000-04-18
2
Medium Priority
?
172 Views
Last Modified: 2010-04-02
I have a problem with list box in visual c++. After å name search I show the results in a list box, but I don't know how I can pick out the right name?
I use xxx.GetText() but then I only get the name displayed in the list box.. I want to get the data that is linked to the name displayed in the list box. (The data linked to each name is adress, phone nr and so on...)
Is there a command that returns the line nr in the list box? Or returns a path to the data linked to the name I clicked on?
0
Comment
Question by:andreas75
[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 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2726110
How was the data loaded into the listbox. Was the data associted with each entry using SetItemData or SetItemDataPtr if so then you can use GetItemData or GetItemDataPtr.

If you have the name can you walk the list of results (the ones you used to load the listbox) and find a match and then get the name, number etc

Sorry I can't be more exact without more info :)
0
 
LVL 1

Accepted Solution

by:
tvanceplus earned 300 total points
ID: 2727105
Here is some code where the resource ID for your list box is IDC_LIST.

int nr;

nr=getitemtoget();

....

CListBox* pList;
pList=(CListBox*)GetDlgItem(IDC_LIST);

CString text;

pList->GetLBText(nr,text);

Now text is whatever text was on line nr or the list box. This also works for combo boxes.

Good Luck!
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 This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

656 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