Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

Mimic Notepad menuEditFind

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James Morton - 06 Apr 2005 16:59 GMT
I am trying to mimic the behavior of notepad where the find form stays in
front and active yet the text form actively highlights the search string.
Right now I have to close the find form in order to see the highlighted
text.

What do I need to do? Here is what I have now (note I am using the text
forms in an MDI.

in the main form

private void menuEditFind_Click(object sender, System.EventArgs e)

{

frmFind f = new frmFind(this);

f.Show();

}

public void FindNext(string str, frmFind f)

{

try

{

Form activeChild = this.ActiveMdiChild;

TextBox activeTextBox = (TextBox)activeChild.ActiveControl;

activeTextBox.Select(activeTextBox.Text.IndexOf(str), str.Length);

}

catch(Exception ex)

{

MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error
);

}

}

In form find

private System.Windows.Forms.Form frmParent;

public frmFind(frmMain f)

{

frmParent = f;

InitializeComponent();

//

// TODO: Add any constructor code after InitializeComponent call

//

}

private void btFindNext_Click(object sender, System.EventArgs e)

{

frmMain f = (frmMain)frmParent;

f.FindNext(tbSearchString.Text, this);

}

Thanks!!!!!

James M
James Morton - 07 Apr 2005 19:04 GMT
ok its the HideSelection property, found it!!

> I am trying to mimic the behavior of notepad where the find form stays in
> front and active yet the text form actively highlights the search string.
[quoted text clipped - 35 lines]
>
> {

MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error
> );
>
[quoted text clipped - 35 lines]
>
> James M

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.