Solved

Implementing "Find on this page" in WebBrowser

Posted on 2000-05-08
6
854 Views
Last Modified: 2012-06-21
I need to implement the "Find on this page" dialog for the WebBrowser control. I have tried the following, and neither works correctly:

First, I tried sendkeys:
   Me.WebBrowser1.SetFocus
   SendKeys "^F"

This worked for a while, but I had to implement an interface to trap the right click on the menu. Doesn't seem to work anymore.

Second, I tried the ExecWB method. However, this method brings up the Find File method instead.
ActiveForm.WebBrowser1.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DONTPROMPTUSER

Bonus points if you can indicate how to implement "Find Next (F3)" functionality...

0
Comment
Question by:AZWolf7
[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
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2789807
i think trying to find a way to use sendkeys is your best bet...let ie take care of using it...another expert and myself have been attempting to show the find and/or replace dialog ourselves through code but we can't keep it from crashing our programs. there are several pieces of code in C that show how to do it but we have been unable to duplicate it in vb.
0
 

Author Comment

by:AZWolf7
ID: 2789840
I have some C++ code which used the IOleCommand interface, but alas, can't seem to implement it. If I do find it, I'll post it here.
0
 
LVL 14

Accepted Solution

by:
mcrider earned 100 total points
ID: 2790943
This works every time for me...

   WebBrowser1.SetFocus
   SendKeys "^f", True


You MUST send the ^f as lowercase... ^F doesn't work.


Cheers!®©
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:AZWolf7
ID: 2793183
Still didn't take care of all the problems when you implement IDocHostUIHandler, but such a simple solution that works! I guess it is the simeple things that gey ya.. *grin*
thanks!
0
 

Author Comment

by:AZWolf7
ID: 2793185
Still didn't take care of all the problems when you implement IDocHostUIHandler, but such a simple solution that works! I guess it is the simeple things that get ya.. *grin*
thanks!
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2794642
Thanks for the points! Gladd I could help!


Cheers!®©
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

732 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