private void btnReadFile_Click(object sender, EventArgs e) { if ("Cancle".Equals(btnReadFile.Text)) { setViewStatus(_viewStatus.S_NOMAL); _accountList.Clear(); comboBoxResults.Items.Clear(); return; } setViewStatus(_viewStatus.S_UPLOAD); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Please Chose a CSV file..."; openFileDialog.InitialDirectory = @"./"; openFileDialog.Filter = "|*.csv|csv file|*.*|all file|"; openFileDialog.ShowDialog(); string fileName = openFileDialog.FileName; List <object> accountInformationList = _account.loadCsvFile(fileName); if (_accountList != null) { comboBoxResults.Items.Clear(); _accountList.Clear(); } if (accountInformationList == null) { MessageBox.Show("0 results has been found."); return; } if (accountInformationList.Count > 0) { foreach (var item in accountInformationList) { AccountInformation acc = (AccountInformation)item; if (currentUser.Equals(acc.userId)) { _accountList.Add(acc); comboBoxResults.Items.Add(acc.companyName + "_" + acc.loginAccount); } } } if (_accountList.Count > 0) { MessageBox.Show(string.Format("{0} results has been found.", _accountList.Count)); comboBoxResults.SelectedIndex = 0; } }