private void comboBox_Cols_TextChanged(object sender, EventArgs e) { int ColNum = Tabulation.FindCol(MainForm.MainDT, comboBox_Cols.Text); if (ColNum != -1) { Classification = Tabulation.Classification(MainForm.MainDT, ColNum); int len = Classification.Length; if (len > 0) { if (len > 2) { MessageBox.Show("选项超过两种,请使用多选单选题进行分析!"); } else { listBox_TwoChoices.Items.Clear(); listBox_TwoChoices.Items.AddRange(Classification); CountTimes = Tabulation.LikilihoodCount(Classification, MainForm.MainDT, ColNum); StringBuilder OutPut = new StringBuilder(); for (int i = 0; i < len; i++) { OutPut.Append(Classification[i]); OutPut.Append("\t"); OutPut.Append(CountTimes[i].ToString()); OutPut.Append("\r\n"); } textBox_Likihood.Clear(); textBox_Likihood.AppendText(OutPut.ToString()); label4.Text = "其中有多少样本选择了\"" + listBox_TwoChoices.Items[0].ToString() + "\"?"; } } } }
private void comboBox_Cols_TextChanged(object sender, EventArgs e) { int ColNum = Tabulation.FindCol(MainForm.MainDT, comboBox_Cols.Text); if (ColNum != -1) { Classification = Tabulation.Classification(MainForm.MainDT, ColNum); int len = Classification.Length; if (len > 0) { listBox_MultiChoices.Items.Clear(); listBox_MultiChoices.Items.AddRange(Classification); textBox_Times.Clear(); for (int i = 0; i < len; i++) { textBox_Times.AppendText("0\r\n"); } CountTimes = Tabulation.LikilihoodCount(Classification, MainForm.MainDT, ColNum); StringBuilder OutPut = new StringBuilder(); for (int i = 0; i < len; i++) { OutPut.Append(Classification[i]); OutPut.Append("\t"); OutPut.Append(CountTimes[i].ToString()); OutPut.Append("\r\n"); } textBox_Likihood.Clear(); textBox_Likihood.AppendText(OutPut.ToString()); } } }