Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / September 2004



Tip: Looking for answers? Try searching our database.

Please Help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erica - 30 Sep 2004 14:45 GMT
I have an auto search engine submission program. Here is one section of my
code:

Private Function SubmitDMOZ(url As String, email As String, title As String,
desc As String) As Boolean
   Dim NavUrl As String
   
   
   Me.RtfStatus.SelStart = Len(Me.RtfStatus.Text)
   Me.RtfStatus.SelColor = vbBlack
   Me.RtfStatus.SelText = vbNewLine & "Submitting " & Trim(url) & " to Open
Directory"
   
   NavUrl =
"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/Ohio/
Business_and_Economy/Real_Estate
"
   
   
   Me.wbbrowser.Navigate NavUrl
   Do
       DoEvents
   Loop While wbbrowser.Busy
   
   Me.wbbrowser.Document.All("url").Value = Trim(url)
   Me.wbbrowser.Document.All("title").Value = Trim(title)
   Me.wbbrowser.Document.All("description").Value = Trim(desc)
   Me.wbbrowser.Document.All("email").Value = Trim(email)
   Me.wbbrowser.Document.All("submit")(1).Click
   Do
       DoEvents
   Loop While wbbrowser.Busy
   
   If wbtitle = "Submission Received" Then
       SubmitDMOZ = True
   Else
       SubmitDMOZ = False
   End If

End Function
---------------------

At  the Me.wbbrowser.Document.All("url").Value = Trim(url) I get the
following error:

With block not set
Pásztor, Zoltán - 30 Sep 2004 17:58 GMT
> I have an auto search engine submission program. Here is one section
> of my code:
[quoted text clipped - 9 lines]
>
>     NavUrl =

"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/
Ohio/Business_and_Economy/Real_Estate"

>     Me.wbbrowser.Navigate NavUrl
>     Do
[quoted text clipped - 23 lines]
>
> With block not set

Hi Erica,

  I've tried your code in a test project (added a RichTextBox, a WebBrowser
and a CommandButton), and it seems to be working - somehow, if I declare the
wbtitle variable. Other than that, I'd made only minor, non-essential
adjustments.

Here's the modified code - it really shows the web page, then receives an
"incomplete data submitted" response.

'---------------------------------------------------------
  Option Explicit: DefObj A-Z

  Private Function SubmitDMOZ( _
              url As String, email As String, _
              title As String, desc As String _
           ) As Boolean

   Dim NavUrl          As String
   Dim wbtitle         As String      ' ***FORMALLY***

   On Error GoTo ErrHandler

     With RtfStatus
        .SelStart = Len(Me.RtfStatus.Text)
        .SelColor = vbBlack
        .SelText = vbNewLine & "Submitting " & Trim(url) & " to Open
Directory "
     End With

      NavUrl = _

"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/
Ohio/Business_and_Economy/Real_Estate"

     With wbbrowser
        .Navigate NavUrl
        Do
           DoEvents
        Loop While .Busy

        With .Document.All
           .Item("url").Value = Trim$(url)
           .Item("title").Value = Trim$(title)
           .Item("description").Value = Trim$(desc)
           .Item("email").Value = Trim$(email)
           .Item("submit")(1).Click
        End With
        Do
          DoEvents
        Loop While .Busy
     End With

     If wbtitle = "Submission Received" Then   ' ***???***
        SubmitDMOZ = True
     End If
     Exit Function

ErrHandler:
     Beep
     With Err
        Debug.Print "***Unexpected error*** : " & _
           .Number & " (&H" & Hex$(.Number) & ")" & vbNewLine & _
           vbNewLine & "   Source : " & .Source & _
           vbNewLine & "   Descr : " & .Description
     End With
  End Function

  Private Sub cmdGo_Click()
     If SubmitDMOZ("", "", "", "") Then
        Debug.Print "*OK*"
     Else
        Debug.Print "***Failed***"
     End If
  End Sub

'---------------------------------------------------------

hth
Signature

PZ

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.