public void AND(string query) { result r = new result(); TextBox t = new TextBox(); int NWords = 0; //nubmer of words //string query = textBox1.Text; string[] words = query.Split(','); query = ""; for (int j = 0; j < words.Length; j++) { NWords++; } for (int i = 1; i <= x; i++) { and = 0; t.Text = File.ReadAllText("C:\\ShayanSystem\\SoftWares\\IR\\Docs\\" + "Untitled" + Convert.ToString(i) + ".txt"); for (int j = 0; j < words.Length; j++) { if (t.Text.Contains(words[j]) || (Convert.ToString(t.Text).ToUpper()).Contains(words[j]) || Convert.ToString(t.Text).ToLower().Contains(words[j])) { and++; } //MessageBox.Show(Convert.ToString(and)); } if (and == NWords) { andresult = andresult + "1"; if (r.lblr.Text == ".") { r.lblr.Text = Convert.ToString(i); } else if (r.lblr2.Text == ".") { r.lblr2.Text = Convert.ToString(i); } else if (r.lblr3.Text == ".") { r.lblr3.Text = Convert.ToString(i); } else if (r.lblr4.Text == ".") { r.lblr4.Text = Convert.ToString(i); } else if (r.lblr5.Text == ".") { r.lblr5.Text = Convert.ToString(i); } else if (r.lblr6.Text == ".") { r.lblr6.Text = Convert.ToString(i); } else if (r.lblr7.Text == ".") { r.lblr7.Text = Convert.ToString(i); } } else { andresult = andresult + "0"; } } // MessageBox.Show(andresult); // MessageBox.Show(Convert.ToString(NWords)); // r.ShowDialog(); }
public void find() { result r = new result(); TextBox t = new TextBox(); //string sp = (Convert.ToString(t)).Split('""'); for (int i = 1; i <= c; i++) { t.Text = File.ReadAllText("C:\\ShayanSystem\\SoftWares\\IR\\Docs\\" + "Untitled" + Convert.ToString(i) + ".txt"); if ((textBox1.Text.Substring(0, 1) == "\"") && ((Convert.ToString(textBox1.Text)).Substring(Convert.ToInt32((Convert.ToString(textBox1.Text)).Length - 1), 1)) == "\"") { string srch = ((Convert.ToString(textBox1.Text)).Substring(1, (Convert.ToString(textBox1.Text)).Length - 2)); //MessageBox.Show(srch); if (t.Text.Contains(srch)) { if (r.lblr.Text == ".") { r.lblr.Text = Convert.ToString(i); } else if (r.lblr2.Text == ".") { r.lblr2.Text = Convert.ToString(i); } else if (r.lblr3.Text == ".") { r.lblr3.Text = Convert.ToString(i); } else if (r.lblr4.Text == ".") { r.lblr4.Text = Convert.ToString(i); } else if (r.lblr5.Text == ".") { r.lblr5.Text = Convert.ToString(i); } else if (r.lblr6.Text == ".") { r.lblr6.Text = Convert.ToString(i); } else if (r.lblr7.Text == ".") { r.lblr7.Text = Convert.ToString(i); } } } else { if (t.Text.Contains(textBox1.Text) || (Convert.ToString(t.Text).ToUpper()).Contains(textBox1.Text) || (Convert.ToString(t.Text).ToLower()).Contains(textBox1.Text)) { if (r.lblr.Text == ".") { r.lblr.Text = Convert.ToString(i); } else if (r.lblr2.Text == ".") { r.lblr2.Text = Convert.ToString(i); } else if (r.lblr3.Text == ".") { r.lblr3.Text = Convert.ToString(i); } else if (r.lblr4.Text == ".") { r.lblr4.Text = Convert.ToString(i); } else if (r.lblr5.Text == ".") { r.lblr5.Text = Convert.ToString(i); } else if (r.lblr6.Text == ".") { r.lblr6.Text = Convert.ToString(i); } else if (r.lblr7.Text == ".") { r.lblr7.Text = Convert.ToString(i); } } } if (textBox1.Text.Contains("(AND)")) { } } r.textBox1.Text = this.textBox1.Text; r.ShowDialog(); }