p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2009, 07:15 AM
Authorized User
Points: 330, Level: 6
Points: 330, Level: 6 Points: 330, Level: 6 Points: 330, Level: 6
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: May 2004
Location: Rawalpindi, -, Pakistan.
Posts: 68
Thanks: 0
Thanked 1 Time in 1 Post
Default Web Browser control - How to make input fields editable?

In my windows form i have created a web browser control (AxSHDocVw). I want to grab user's actions like

1- what links he clicks
2- what information he enteres in the textbox and
3- what text he selects from anywhere from the rendered page.

The problem is that the text boxes are not editable. I mean user can not enter or select any text from them. I guess i am missing some minor thing.
Please have a look at the necessary code here:


using System;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using mshtml;
using MsHtmHstInterop;
using AxSHDocVw;

[Serializable]
public class HtmlUIForm : Form, IDocHostUIHandler
{
protected AxWebBrowser WebBrowser;

public HtmlUIForm()
{
InitializeComponent();

this.WebBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(th is.WebBrowser_DocumentComplete);

object flags = 0;
object targetFrame = String.Empty;
object postData = String.Empty;
object headers = String.Empty;
this.WebBrowser.Navigate("about:blank", ref flags, ref targetFrame, ref postData, ref headers);

ICustomDoc cDoc = (ICustomDoc)this.WebBrowser.Document;
cDoc.SetUIHandler((IDocHostUIHandler)this);


this.WebBrowser.Navigate("https://login.yahoo.com/config/login_verify2?&.src=ym", ref flags, ref targetFrame, ref postData, ref headers);
}


private void WebBrowser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
IHTMLDocument2 doc = (IHTMLDocument2)this.WebBrowser.Document;
HTMLButtonElement button = (HTMLButtonElement)doc.all.item("theButton", null);
((HTMLButtonElementEvents2_Event)button).onclick += new HTMLButtonElementEvents2_onclickEventHandler(this. Button_onclick);

}

private bool Button_onclick(IHTMLEventObj e)
{
MessageBox.Show("Alert from the app: Received theButton.onclick!");
return true;
}


[STAThread]
static void Main(string[] args)
{
Application.Run(new HtmlUIForm());
}
}
__________________
BaburMan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 5th, 2009, 07:52 AM
samjudson's Avatar
Friend of Wrox
Points: 4,453, Level: 28
Points: 4,453, Level: 28 Points: 4,453, Level: 28 Points: 4,453, Level: 28
Activity: 60%
Activity: 60% Activity: 60% Activity: 60%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 1,359
Thanks: 0
Thanked 31 Times in 31 Posts
Default

Try using the WebBrowser control, which is built in to the .Net Framework.
__________________
/- Sam Judson : Wrox Technical Editor -/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 6th, 2009, 11:30 AM
Authorized User
Points: 330, Level: 6
Points: 330, Level: 6 Points: 330, Level: 6 Points: 330, Level: 6
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: May 2004
Location: Rawalpindi, -, Pakistan.
Posts: 68
Thanks: 0
Thanked 1 Time in 1 Post
Default

It works. Thanks
__________________
BaburMan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Browser Control AccessAasif@aol.com C# 2005 1 January 9th, 2008 06:26 AM
Using web browser control in C#2.0 AccessAasif@aol.com C# 5 November 1st, 2007 01:01 PM
how to make Ultragrid editable ? remya_pn Pro VB 6 0 February 26th, 2007 06:55 AM
Web Browser Activex Control gdelucchi Access 0 February 20th, 2006 02:18 PM
web control not displaying in browser rj1406 ASP.NET 1.0 and 1.1 Basics 8 September 19th, 2004 06:32 AM



All times are GMT -4. The time now is 07:23 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc