Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Vb.Net equivalent of VB6 HTMLElement.Click

Posted on 2014-01-09
10
Medium Priority
?
696 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
[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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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
 

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 2000 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

Independent Software Vendors: 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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

610 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