private void addAllRowsCols(string sheetName) { Dictionary <String, List <String> > allRowsCols = new Dictionary <string, List <string> >(); allRowsCols = excelTool.getAllObj(path, sheetName); foreach (var item in allRowsCols) { objDictionary.Add(item.Key, item.Value); listBox1.Items.Add(item.Key); } listBox1.SelectedIndex = listBox1.Items.Count - 1; }