Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox and AnsiString

Status
Not open for further replies.

davman2002

Programmer
Nov 4, 2002
75
0
0
US
I have an extensive understanding of Visual Basic and a basic knowledge of C++. I know that this can be done in C++ however, I am having a major problem trying to understand the AnsiString process. (It is so much easier in VB) My problem is that I need to get a value that is stored in a listbox. I want to know what value that the user has selected. I know how to get the index value of the selected item however I cannot seem to get the actual text value listed in that index. PLease help!!!!!

THanks in advance
 
I have found out how to do it here is the code for those who may have the same question

{
int Pos = lstNames->ItemIndex;

AnsiString Name = lstNames->Items->operator [](Pos);

int Comma = Name.Pos(",");

lblFName->Caption = Name.SubString(Comma+1,50);
lblLName->Caption = Name.SubString(0,Comma-1);

}
 
Edit1->Text = ListBox1->Items->Strings [ListBox1->ItemIndex];
AnsiString string = ListBox1->Items->Strings [ListBox1->ItemIndex];

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top