Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

list box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wayne - 18 Mar 2005 08:33 GMT
hi,

how can i read a list box from the first entry to the last? cos i
understand that the cursor will be at the end and hence i wont b able
to use GetCurSel().

thus how can i pick up the content of the list box from the top to the
bottom?

thanks


Severian - 18 Mar 2005 19:29 GMT
>hi,
>
[quoted text clipped - 4 lines]
>thus how can i pick up the content of the list box from the top to the
>bottom?

In C, Something like:

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>

int SevListBoxList(HWND hlist)
{
 TCHAR strval[MAX_LBOX_LEN+1];

 int i, c = (int)SendMessage(hlist, LB_GETCOUNT, 0, 0);
 for (i=0; i<c; i++) {
   if ((int)SendMessage(hlist, LB_GETTEXTLEN, i) <= MAX_LBOX_LEN) {
     SendMessage(hlist, LB_GETTEXT, i, strval);
     printf("%d: %s\n", i, strval);
   } else
     printf("%d: (STRING TOO LONG)\n", i);
 }
 return i;
}

Using MFC/CListBox, I suppose it would be something like

#include <windows.h>
#include <iostream>

int SevCListBoxList(CListBox *plist)
{
 CString strval;
 int i, c = plist->GetCount();

 for (i=0; i<c; i++) {
   plist->GetText(i, strval);
   cout << i << ": " << strval << endl;
 }
 return i;
}

--
Sev

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.