<A class=F11 id=moreFF4Link style="DISPLAY: inline" onclick="showMoreFF4('on');clickTrackSwbdAttr('BP:Attributes:Additional Info:Show More','Trattoria-Pizzeria-Roma Inc','Pizza Restaurants, Restaurant Management &amp; Consultants')" href="javascript:void(0);"><BR>Show More &gt;</A>

This is the html of that page. I am looking forward to clicking on 'show more'
I am using a instance of Ie to open this page, As this is supposed to back end process I can't use sendkey
Any other way to get around?

Edited 3 Years Ago by Reverend Jim: Fixed formatting

Any other way to get around?

Use web browser control.

Here's your (simplified and modified) HTML

<html>
	<script>
		function showMoreFF4()
		{
			alert('foo');
		}
		</script>
<body>
	<A id=moreFF4Link style="DISPLAY: inline" onclick="showMoreFF4()" href="javascript:return(0);"><BR>Show More &gt;</A>
</body>
</html>

And the code to "click" that link

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  ' Load test page
  WebBrowser1.Navigate("http://127.0.0.1/test.html")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  '
  Dim Link As HtmlElement

  ' Get element
  Link = WebBrowser1.Document.GetElementById("moreFF4Link")
  ' Found?
  If Link IsNot Nothing Then
    ' Call method
    Link.InvokeMember("onclick")
  End If

End Sub

If you want to use external browser, you can't access the document itself. You could try to send a mouse click. Google http://www.google.com/search?q=send+mouse+click+vb.net but I doubt a bit you'll find a reliable method to send a mouse click exactly where you want to.

HTH

The query was for vb and not vb.net.

There's some problem with this loop

If Link IsNot Nothing Then

' Call method

Link.InvokeMember("onclick")

End If

it gives an error 424: object required
and yah i can't find htmlelement in vb and hece used htmlanchorelement

Thanks for help

The query was for vb and not vb.net.

This is VB.NET forum.

There's some problem with this loop

It's not a loop, it's an If statement :)

it gives an error 424: object required

It has a test If Link IsNot Nothing Then to ensure that Link variable is an object. So it must be InvokeMember("onclick") part that causes the error. That method doesn't produce an error even if the member (onclick in this case) isn't found. It seems that you've slightly modified the code and run it with VB6, am I right? ;)

for counter=1 to 3
print ("sorry")
next

1) I can't find a vb forum here

2) as you would have already known, am a beginner and was out of my mind then

3) If Link IsNot Nothing Then was giving a error as invalid use of property so removed it,
so you're right the problem is with InvokeMember("onclick") any solutions.....!!!!

I can't find a vb forum here

Here's DaniWeb's Visual Basic 4 / 5 / 6 forum.

as you would have already known, am a beginner and was out of my mind then

That's ok :)

any solutions.....!!!!

VB6's web browser control does not have either GetElementById or InvokeMember methods. I can think of only two solutions: try to google (I gave link before) how to send mouse clicks, or the better one, close this thread and re-post this question to DaniWeb's Visual Basic 4 / 5 / 6 forum.

I still have VB6 installed so I took a quick look, but I didn't find any solution with VB6, sorry!

This article has been dead for over six months. Start a new discussion instead.