void Bind() { decimal ctype = 2; decimal machineseq = 0; if (RBLishi.Checked) { ctype = 2; } else { ctype = 3; } if (textBox1.Text == "") { machineseq = 0; } else { bool flag = decimal.TryParse(textBox1.Text, out machineseq); if (!flag) { MessageBox.Show("输入错误"); return; } } List <SortReplaceInfo> list = new List <SortReplaceInfo>(); list = SortClass.GetSortThroughInfo(ctype, machineseq); dataGridView1.DataSource = list; }