private void ComboboxSave() { XmlRead read = new XmlRead(); int result = 0; try { int num2; read.Delete(FileName.File1); int.TryParse(this.txt_1.Text, out result); result--; if (result < 0) { result = 0; } DataTable table = ExcelRead.ExcelToDataTable(this.file_1.get_TextBoxFile().Text, this.com_sheet_1.Text.Trim() + "$", 0); for (num2 = 0; num2 < table.Columns.Count; num2++) { int num3 = num2 + 1; read.File1AppendChild("1." + num3.ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString()); } read.Delete(FileName.File2); int.TryParse(this.txt_2.Text, out result); result--; if (result < 0) { result = 0; } if (File.Exists(this.file_2.get_TextBoxFile().Text.Trim())) { DataTable table2 = ExcelRead.ExcelToDataTable(this.file_2.get_TextBoxFile().Text, this.com_sheet_2.Text.Trim() + "$", 0); for (num2 = 0; num2 < table2.Columns.Count; num2++) { read.File2AppendChild("2." + ((num2 + 1)).ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString()); } } Regex regex = new Regex(@"^\[\d+\]"); read.SetKey1(regex.Replace(this.combo_1.Text.Trim(), string.Empty)); read.SetKey2(regex.Replace(this.combo_2.Text.Trim(), string.Empty)); } catch (Exception exception) { MessageBoxHelper.Show(exception.ToString(), "异常"); } }