Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to fill a simple web form in with vb .net, and have found numerous samples in VB6, however I can't seem to work out the same in vb .net.

 

I can add the explorer object and navigate to the page, however when I try to use the AxWebBrowser1.documents collection I don't have access to the 'all' or 'forms' objects that the VB6 examples uses.

 

Any help very gratefully received.

 

Andy

  • 10 months later...
  • 3 months later...
Posted

I don't have the same problem, using VB.NET and VS.NET 2003

 

AxWebBrowser.Document.all("fieldname").value = Value

 

However, if you are continuing to have problems, there is another option. I'm going to assume you are trying to POST data, since that requires a more advanced function.

 

Create a new System.Net.WebClient object.

 

Public Class MyWebClient
   Public Client As New System.Net.WebClient
   Public Function HTTPRequest(ByVal URL As String, ByVal postString As String, Optional ByVal Method As String = "POST") As String
       Dim serverResponse() As Byte
       Dim postBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(postString)
       Try
           serverResponse = Me.Client.UploadData(URL, Method, postBytes)
           ' Gets data from server!
       Catch ex As Exception

           MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source & " Error")
           Exit Function
       End Try
       Dim responseHTML As String = (System.Text.Encoding.ASCII.GetString(serverResponse))
       ' Turns server response(in bytes) into a string(HTML)
       Return responseHTML
   End Function
End Class

 

postString are your field arguments, the format for postString is as such

 

"fieldname=value&fieldname2=value2&ect=ect&ect=ect"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...