473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

webbrowsercontrol & reflection

Hello,

I'm using the webbrowser control to display a webpage on my form. The first
problem is the gets fired for every image which is completed as well.
http://support.microsoft.com/?id=180366 describes a solution but I'm not
able to port the if to C# :

VB
---
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object,
URL As Variant)
If (pDisp Is WebBrowser1.Object) Then
Debug.Print "Web document is finished downloading"
End If
End Sub

C#
---
private void IE_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if (????????????????????????)
MessageBox.Show("finished loading");
}
Then I want to use reflection to fill in a field on the form.

object [] _name = {"q"}; // the textbox to fill
object [] _value = {"value", "hello world"}; // the text to fill it with
object o = IE.Document.GetType().InvokeMember("getElemenById" ,
System.Reflection.BindingFlags.InvokeMethod, null, IE.Document, _name);
o.GetType().InvokeMember("setAttribute",
System.Reflection.BindingFlags.InvokeMethod, null, o, _value);

The above code compiles but when run it just hangs on "object o = ..." and I
don't see any reason why. Any ideas ?

TIA

Yves
Nov 16 '05 #1
1 1570
Yves,

I believe that the syntax for the event handler that you want is:

if (e.pDisp == IE.Object)
{

}

As for using reflection, why are you not binding to the MSHTML interop
library? It would make using all of this much, much easier.

Hope this helps.

"phoenix" <pa******@skynetWORK.be> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hello,

I'm using the webbrowser control to display a webpage on my form. The first problem is the gets fired for every image which is completed as well.
http://support.microsoft.com/?id=180366 describes a solution but I'm not
able to port the if to C# :

VB
---
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object,
URL As Variant)
If (pDisp Is WebBrowser1.Object) Then
Debug.Print "Web document is finished downloading"
End If
End Sub

C#
---
private void IE_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if (????????????????????????)
MessageBox.Show("finished loading");
}
Then I want to use reflection to fill in a field on the form.

object [] _name = {"q"}; // the textbox to fill
object [] _value = {"value", "hello world"}; // the text to fill it with
object o = IE.Document.GetType().InvokeMember("getElemenById" ,
System.Reflection.BindingFlags.InvokeMethod, null, IE.Document, _name);
o.GetType().InvokeMember("setAttribute",
System.Reflection.BindingFlags.InvokeMethod, null, o, _value);

The above code compiles but when run it just hangs on "object o = ..." and I don't see any reason why. Any ideas ?

TIA

Yves

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: phoenix | last post by:
Hello, I'm using the webbrowser control to display a webpage on my form. The first problem is the gets fired for every image which is completed as well. http://support.microsoft.com/?id=180366...
12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
1
by: Mike Malter | last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I can call that method again later using reflection. I am...
0
by: James Cohen | last post by:
Hi, I hope somebody can help me out, Im looking for a way to retreive the original filename & line number of a Reflection.MemberInfo instance. Ill provide some background on what it is that im...
8
by: paccala | last post by:
Ciao Being google-ing since hours and still I'm not able to solve my problem... I have following hierarchy: class A { public void myMethod(); }
0
by: Peter | last post by:
Using CDO 1.21 how do I get First Name and Last Name from Global Address Book? I have the following code where I retrieve LastName and FirstName in one field, but how do I get LastName and...
4
by: Tobias Winter | last post by:
Hi I want to know how I can retrieve the 'onchange'-Event of an HTML-Input-Element in my vb.net-code? I have access to the documentproperty (DOM) of the Webbrowsercontrol Thx Tobias
7
by: D Miller | last post by:
Here is today's challange... I would like to scan though the properties of the class and take actions based on the name of the property. Something Like Dim Work as new Test
0
by: Morgan Cheng | last post by:
I have one webservice written in MC++, which uses another native DLL deployed in %webservice_install_dir%\bin folder. The API invocation between MC++ and native C++ looks seamless. The compilation...
4
by: Ian Semmel | last post by:
If I navigate to say http://Site/filename.csv, the web browser control or IE displays an excel sheet with the data in it. (Safari displays the raw text). This is not what I want. I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.