/* Changed to smth like SelectedIndexChanged */ private void sourceLst_SelectedValueChanged(object sender, EventArgs e) { if (sourceLst.SelectedIndex >= codeFiles.Length) { return; } CodeFile currentCodeFile = filteredCodeFiles[sourceLst.SelectedIndex]; fileNameTxt.Text = currentCodeFile.GetFileName(); string[] codeLines = currentCodeFile.GetCodeLines(); codeTxt.Clear(); foreach (string codeLine in codeLines) { codeTxt.Text += codeLine + "\r\n"; } }