lalit_2007

hi,

i want to develop a windows application using c#.net.The functionality will be like the same as find and replace functionality in windows.

can any body give a full idea how to develope this

thanks a lot in advance.




Re: Visual C# General want to create a tool which give find and replace functionality

Peter Ritchie

The Platform SDK / Win32 contains a function FindText that has a common search dialog that you can use.

If you want to search a RichTextBox control in your app, .NET already makes use of FindText in that control via the Find methods.






Re: Visual C# General want to create a tool which give find and replace functionality

OmegaMan

The usage of regular expressions can help you parse and replace the data in set patterns in the text.

Check out the MSDN's .Net Regular Expression forum for help with regex'es and the top announcement .Net Regex Resource Reference which has referential information geared towards all levels from expert to beginner.





Re: Visual C# General want to create a tool which give find and replace functionality

lalit_2007

Hi peter,

Thanks fr reply.

but my tool is like, i ll open a file using that tool.The file may be text file or excel sheet.

In that particular file i want to implement the find and replace functionality.i.e. I ll find a string in that file to replace with another and after that i should able to save the changes in the file.

hope u understand my problem.

can u please give some idea

please reply..............






Re: Visual C# General want to create a tool which give find and replace functionality

Martin Xie - MSFT

The following article including good sample and explanation will be very helpful to you.

Find and Replace with Regular Expressions

This article demonstrates how to use regular expressions and RegEx class (System.Text.RegularExpressions namespace) to build the find and replace functionality found in most of the text editors and word processors. The functionalities like whole word search or case sensitive/insensitive search can be implemented much easier using Regular Expressions than using any other methods.

Another references

Visual Studio Find/Replace Regular Expression usage

Search and Replace text in Notepad RE using Regular Expressions

This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.






Re: Visual C# General want to create a tool which give find and replace functionality

OmegaMan

Hi Martin,

The regex language used in Visual Studio is 180 degrees different from the regex pattern language as used by the .Net regex engine. Patterns from one cannot be used by the other.

See my top level announcement in the Regex forum entitled Visual Studio Regular Expressions to see the differences.

Thanks.