Hi
The scenario is this:
1. I have a multiline TextBox in my Web application
2. i search a string from the text found in the TextBox
3. After i find the string in the TextBox i must give the line number of where it is in the Textbox or even highlighted or underlined etc

My question is how to do part 3. I know some of you might tell me to use a richTextBox but i am working on a web application and not a windows application and i do not know how to combine the two projects. I have also tried using SelectionStart() and SelectionLength() but my Web application keeps giving me an error for selectionstart() and selectionlength() (and i did put the reference system.windows.dll but it still is not recognizing them.)

Any ideas of how to do part3 will be greatly appreciated
I am using c#

For SelectionStart and SelectionLength it is giving me an error :(
They can only be used with a windows application whereas i am using a Web application. Is there another way??
or maybe is there a way of using a windows form with my web application??

Hi,
I'm new to programming, but have been doing something similar in a Windows Application, i got it working by doing the following code;

// Length of Search Value
            int txtLength = tbSearch.Text.Length;
// TextBox Value - Contents from Main Form
            string mainString = frmMain.textSearch;
// Text of Search TextBox
            string searchString = tbSearch.Text;
// Position of Sring from Search Value
            int position = mainString.IndexOf(searchString);

// If position equals -1 that means no result was found.
            if (position == -1)
            {
                MessageBox.Show("No text matching '" +             tbSearch.Text.ToString() + "' has been found.", "No Search Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                frmMain.txtLength = txtLength;
                frmMain.txtPosition = position;
                Close();
            }

Then on my main Form i used the following code to highlight the text needed;

// Search TextBox Length and Position
        public static int txtLength;
        public static int txtPosition;

// Goes to the position of the Text and then highlights it by using the Length of the text specified..
textBox1.Select(txtPosition, txtLength);

Hope this might help with what you are trying to do, let me know...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.