Exemplo n.º 1
0
        private void Cities_SelectedIndexChanged(object sender, EventArgs e)//"EventArgs - an event handler"
        {
            //Whenever an item is selected in the Cities groupbox, a message box
            //will pop up with the selected item
            string text = Cities.GetItemText(Cities.SelectedItem);//Getting the selected list item .

            //The method "GetItemText" gets the the actual value
            //of the selected item (inside the "Cities"),
            //then it's assigned to the "text" variable...
            MessageBox.Show(text);//MessageBox to show the value
            //Playing with it : MessageBox.Show("Stas");//MessageBox to show the value
        }