[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Add 'Find' Functionality to Forms App

Posted on 2009-07-01
1
Medium Priority
?
230 Views
Last Modified: 2013-12-17
I have a text box populated with the content of a text file.  I would like to give the user the ability to search that text box.  How can I do this?
0
Comment
Question by:thegreekitalian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 24758404
Something like...

        private void button1_Click(object sender, EventArgs e)
        {
            string value = textBox2.Text;
            int index = textBox1.Text.IndexOf(value);
            if (index != -1)
            {
                // it was found...highlight it:
                textBox1.SelectionStart = index;
                textBox1.SelectionLength = value.Length;
                textBox1.Focus();
            }
            else
                MessageBox.Show(value, "Not Found");
        }

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question