Battle_Script_Pro.Form1.PressedFind C# (CSharp) Method

PressedFind() private method

private PressedFind ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void PressedFind(object sender, EventArgs e)
        {
            int startIndex = 0;
            int endIndex = 0;
            int start = scripts[tabControl1.SelectedIndex].SelectionStart + scripts[tabControl1.SelectedIndex].SelectionLength;
            if (openFindForm.txtSearch.Text.Length > 0)
            {
                startIndex = FindMyText(openFindForm.txtSearch.Text.Trim(), start, scripts[tabControl1.SelectedIndex].Text.Length);
                if (startIndex == -1)
                {
                    start = 0;
                    startIndex = FindMyText(openFindForm.txtSearch.Text.Trim(), start, scripts[tabControl1.SelectedIndex].Text.Length);
                    if (startIndex == -1)
                    {
                        MessageBox.Show("The requested string could not be found.");
                        return;
                    }
                }
            }
            if (startIndex >= 0)
            {
                endIndex = openFindForm.txtSearch.Text.Length;
                start = startIndex + endIndex;
            }
            scripts[tabControl1.SelectedIndex].Focus();
        }
Form1