Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on 

Vb.Net equivalent of VB6 HTMLElement.Click

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
Visual Basic.NET

Avatar of undefined
Last Comment
Jimbo99999
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

Thanks for your response.  I will hope to get back to this little project this afternoon.

jimbo99999
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Equivalent in VB.NET would be

submitElement.RaiseEvent("Click")
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

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
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Does it work with

submitElement.RaiseEvent("click")

?
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

Yes. I received the above error using it.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

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?
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

Thanks for your efforts...they led to make that discovery soultion.

Have a good day,
jimbo99999
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo