you do not give much idea of what you want to do or how you want to do it
if using a webbrowser control or automation of internet explorer
vb Code:
For Each ele In ie.document.getelementsbytagname("a")
If ele.innertext = "Do you want to upload several files? Please click here" Then ele.Click
Next
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
there are many ways to work with webpages, depends on the site and what you want to do
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Add a a reference to "Microsoft Internet Transfer Control", then place Inet control to the form and add this function:
Code:
Private Function ConditionString(URL As String, Condition As String) As Boolean
Dim tmpStr As String
Dim tmpMass() As String
tmpStr = Inet1.OpenURL(URL)
tmpMass = Split(tmpStr, Condition)
If UBound(tmpMass) <> 0 Then
ConditionString = True
Else
ConditionString = False
End If
End Function
Function returns boolean (True or False). Use it like this:
Code:
Dim tmp As Boolean
tmp = ConditionString("www.google.com", "LOL")
If tmp = True Then
MsgBox "Webpage contains this text!"
Else
MsgBox "Webpage doesn't contain this text!"
End If
Of course, Google doesn't contain word "LOL", so function in this case will return False
I hope this will help you
Last edited by RaZeR; Jul 26th, 2009 at 09:52 AM.
VB 6, VB.NET, C#, Java, JavaME, C/C++ and Assembler Programmer
can you please give me a little detail on how to deploy this code??
Ok. For example, on form you have a WebBrowser named WebBrowser1, a textbox for URL named txtAdress and a button named cmdCheckWord. Put my function in the code and put this code into cmdCheckWord_Click():
Code:
Dim WordToCheck as string
WordToCheck = InputBox "Enter a word to compare: "
If ConditionString(txtAdress, WordToCheck = True Then
MsgBox "Webpage contains this text!"
Else
MsgBox "Webpage doesn't contain this text!"
End if
I can give you a sample project, if you need it
VB 6, VB.NET, C#, Java, JavaME, C/C++ and Assembler Programmer