public void SetFileName(string fileName) { FileName = fileName; if (string.IsNullOrEmpty(FileName)) { return; } if (!File.Exists(fileName)) { FileStream a = File.Create(fileName); a.Close(); System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream nounStream = asm.GetManifestResourceStream("ExamplePlugin." + fileName); if (nounStream != null) { //Writing in new file StreamWriter swr = new StreamWriter(fileName); string tempString; string inputText = ""; StreamReader sr = new StreamReader(nounStream); while (!string.IsNullOrEmpty(tempString = sr.ReadLine())) { inputText += (tempString + "\n"); } swr.Write(inputText); swr.Close(); richTextBox1.Text = inputText; } } OpenInputFile(FileName); searchBox = new SearchBox(); searchBox.rtb = richTextBox1; }
/// <summary> /// Pressing the F3 and searching again inside rich text box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void findAgainToolStripMenuItem_Click(object sender, EventArgs e) { if (searchBox == null || searchBox.IsDisposed) { searchBox = new SearchBox(); searchBox.Show(); } if (tabPageHindi.ContainsFocus) { searchBox.rtb = this.richTextBoxHindi; } else { searchBox.rtb = this.richTextBoxNepali; } searchBox.FindText(sender, e); //this.Hide(); //searchBox.Show(); }