Prev: Runtime Error 429 "ActiveX Component can't create object" SOLVED
Next: in VB6, how to get an equation from the ChartSpace control
From: Karl E. Peterson on 30 Jun 2010 21:22 Leo explained : > I would have thaught INSTR would do the trick for finding Yep, it'll work just fine. Along with InstrRev (remember the search can be in either direction). For simple searches. But the dialog offers options for matching case and whole words only, too. So what defines a "whole word" then? That's gonna be different to everyone, I bet. And how about wrapping the search around from bottom to top, or top to bottom? > and using a module > level variable for keeping track of where to start searching from I'd probably just use .SelStart if it were a textbox. > and maybe one for the search term too check if we it is a new > term/string to search for. Not following you there. The dialog returns/holds the search term for you, as does the class even after the dialog is dismissed. -- ..NET: It's About Trust! http://vfred.mvps.org
From: Kevin Provance on 30 Jun 2010 21:23 "Leo" <ttdhead(a)gmail.com> wrote in message news:i0gq49$u7o$1(a)news.eternal-september.org... : : I would have thaught INSTR would do the trick for finding and using a : module level variable for keeping track of where to start searching : from and maybe one for the search term too check if we it is a new : term/string to search for. Many moons ago I rolled my own Find/Replace which is no longer used in production, but as I never delete anything code wise, I would imagine it's still around someplace and would work great with this project. I guess maybe - considering Karl's events - I would pass the whole text and also pass back the position to highlight using the Find/Replace events. Replace all I would handle all at once with Replace, allowing for case sensitive searches and the like. I guess we would be grateful there isn't pattern matching included. There a bunch of different ways to go here. I have confidence Karl will pick (or rather, write) the best. <g> -- Customer Hatred Knows No Bounds at MSFT Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc Bawwk! Paulie want a dingleball, bawwk!
From: Leo on 30 Jun 2010 21:30 Karl E. Peterson submitted this idea : > Leo explained : >> I would have thaught INSTR would do the trick for finding > > Yep, it'll work just fine. Along with InstrRev (remember the search can be > in either direction). For simple searches. But the dialog offers options > for matching case and whole words only, too. So what defines a "whole word" > then? That's gonna be different to everyone, I bet. And how about wrapping > the search around from bottom to top, or top to bottom? > >> and using a module level variable for keeping track of where to start >> searching from > > I'd probably just use .SelStart if it were a textbox. > >> and maybe one for the search term too check if we it is a new term/string >> to search for. > > Not following you there. The dialog returns/holds the search term for you, > as does the class even after the dialog is dismissed. Wasn't thinking straight there. SelStart would work as thats how Notepad soes it, it doesn't care if the user chooses to move the cursor to say back before the last found item thus finding it again and not the next one. -- ClassicVB Users Regroup! comp.lang.basic.visual.misc Free usenet access at http://www.eternal-september.org
From: Karl E. Peterson on 30 Jun 2010 21:30 Kevin Provance was thinking very hard : > "Leo" <ttdhead(a)gmail.com> wrote in message > news:i0gq49$u7o$1(a)news.eternal-september.org... >> >> I would have thaught INSTR would do the trick for finding and using a >> module level variable for keeping track of where to start searching >> from and maybe one for the search term too check if we it is a new >> term/string to search for. > > Many moons ago I rolled my own Find/Replace which is no longer used in > production, but as I never delete anything code wise, I would imagine it's > still around someplace and would work great with this project. > > I guess maybe - considering Karl's events - I would pass the whole text and > also pass back the position to highlight using the Find/Replace events. > Replace all I would handle all at once with Replace, allowing for case > sensitive searches and the like. I guess we would be grateful there isn't > pattern matching included. > > There a bunch of different ways to go here. I have confidence Karl will > pick (or rather, write) the best. <g> It's the "Match whole words only" part where it really gets spooky. <g> I remember entering a contest Crescent Software held back in the 80s to see who could write the fastest Word Counter app with QuickBasic. OMG, the issues come at you fast and furious, and at some point you just have to close your eyes and *hope*. <g> Proposal: Go ahead with Instr, and when you find a match check the character before and after to see if it's alpha? Would that cover 99% of the cases? Of course, "back in the day", no one used those funky accented upper-ASCII things, either. And if you *really* wanted to write an all-purpose routine, you'd have to include full-on Unicode support, too, eh? I have no idea how to define a "whole word" in that realm. -- ..NET: It's About Trust! http://vfred.mvps.org
From: Karl E. Peterson on 30 Jun 2010 21:31
Leo submitted this idea : > Karl E. Peterson submitted this idea : >> Leo explained : >>> I would have thaught INSTR would do the trick for finding >> >> Yep, it'll work just fine. Along with InstrRev (remember the search can be >> in either direction). For simple searches. But the dialog offers options >> for matching case and whole words only, too. So what defines a "whole >> word" then? That's gonna be different to everyone, I bet. And how about >> wrapping the search around from bottom to top, or top to bottom? >> >>> and using a module level variable for keeping track of where to start >>> searching from >> >> I'd probably just use .SelStart if it were a textbox. >> >>> and maybe one for the search term too check if we it is a new term/string >>> to search for. >> >> Not following you there. The dialog returns/holds the search term for you, >> as does the class even after the dialog is dismissed. > > Wasn't thinking straight there. SelStart would work as thats how Notepad soes > it, it doesn't care if the user chooses to move the cursor to say back before > the last found item thus finding it again and not the next one. Yeah, it's easy to try too hard, isn't it? -- ..NET: It's About Trust! http://vfred.mvps.org |