473,396 Members | 1,599 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,396 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
Jul 21 '05 #1
1 1324
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

Jul 21 '05 #2

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

Similar topics

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...
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.