Solved

Vb.Net equivalent of VB6 HTMLElement.Click

Posted on 2014-01-09
10
627 Views
Last Modified: 2014-02-13
Good Day Experts!

Yet another first here that I hope you can help me out with.  

I converted a little VB6 project to Vb.Net(2005).  I am having trouble with some HTML in it.

Dim x As HTMLHtmlElement
Dim xc As IHTMLElementCollection
For Each x In xc
    If InStr(x.outerHTML, "Enter") > 0 Then
        Set submitElement = x
        Exit For
    End If
Next

submitElement.Click

The trouble I am having is finding the VB.Net equivalent for the .Click on submitElement.

Please ask questions as I am out of ideas after a a few hrs of trying.

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
  • 5
  • 4
10 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39770432
Can you put what you are doing into context, what is it you are trying to achieve? Are you manipulating an associated web page somewhere, or is this just an arbitrary collection of elements?

I only ask because there may be a better way to achieve what you want rather than attempting a like-for-like conversion.
0
 

Author Comment

by:Jimbo99999
ID: 39799811
Thanks for your response.  I will hope to get back to this little project this afternoon.

jimbo99999
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39806726
Equivalent in VB.NET would be

submitElement.RaiseEvent("Click")
0
 

Author Comment

by:Jimbo99999
ID: 39816169
Hello everyone...finally able to get back on this project.

I am just trying submitElement.RaiseEvent("Click") now and am receiving an error.
"An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll.  Additional information: Value does not fall within the expected range".

The messagebox has two button labelled <Break> and <Continue>.  My breakpoint is now green with an error in the left margin.

Any ideas? I am starting my search now.

Thanks,
jimbo99999
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39816307
Does it work with

submitElement.RaiseEvent("click")

?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Jimbo99999
ID: 39816859
Yes. I received the above error using it.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39817334
You replied "Yes" to my question "Does it work with following" but also said you received an error. So does it work or do you still receive the same error?
0
 

Author Comment

by:Jimbo99999
ID: 39817668
I apolgize, it was late when I responded.

I receive the error using submitElement.RaiseEvent("click").

I was just trying anything I could find while searching on the net.  This is working but I don't understand why:

submitElement.InvokeMember("Click")

Thanks,
jimbo99999
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39818274
Ah that should work. I knew there is a method which is used to raise events but told you about the wrong method.
0
 

Author Closing Comment

by:Jimbo99999
ID: 39856972
Thanks for your efforts...they led to make that discovery soultion.

Have a good day,
jimbo99999
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now