UpperCase (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses a list box and a button on a form. Use the Items property editor in the Object Inspector to enter a list of strings in the list box. When the application runs and the button is clicked, the strings in the list box become uppercase.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  for (int I = 0; I < ListBox1->Items->Count; I++)
    ListBox1->Items->Strings[I] = UpperCase(ListBox1->Items->Strings[I]);
}

__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
  ListBox1->Items->Add("Not");
  ListBox1->Items->Add("In");
  ListBox1->Items->Add("Alphabetical");
  ListBox1->Items->Add("Order");
}

Uses