private void txTime_OnLostFocus(object sender, System.EventArgs e) { //get index of selected swimmer int i = lsSwimmers.SelectedIndex; //get that swimmer Swimmer swm = (Swimmer)ar[i]; swm.time = txTime.Text; }
private void lsSwimmers_SelectedIndexChanged(object sender, System.EventArgs e) { //get index of selected swimmer int i = lsSwimmers.SelectedIndex; //get that swimmer Swimmer swm = (Swimmer)ar[i]; //display her time txTime.Text = swm.getTime(); }
//------------------------- private void init() { ar = new ArrayList(); //create array list csFile fl = new csFile("500free.txt"); //read in liens string s = fl.readLine(); while (s != null) { //convert to tokens in swimmer object Swimmer swm = new Swimmer(s); ar.Add(swm); s = fl.readLine(); } fl.close(); //add names to list box for (int i = 0; i < ar.Count; i++) { Swimmer swm = (Swimmer)ar[i]; lsSwimmers.Items.Add(swm.getName()); } }