SubmitForm Method  
 

Submits the current form to the server for processing.

Syntax

object.SubmitForm( Buffer, [Length], [Options] )

Parameters

Buffer
A string or byte array that will contain the output generated by the script. Typically this is HTML content which is generated by the script as a result of processing the data that was posted to it.
Length
An optional integer variable which specifies the maximum number of characters or bytes to be copied into the buffer. This variable will be updated with the actual number of characters or bytes copied when the method returns.
Options
An optional integer value which specifies one or more options. This argument is constructed by using a bitwise operator with any of the following values:
Constant Description
httpSubmitDefault The default submission mode. The contents of the buffer are encoded and sent as standard form data. The data returned by the server is copied to the result buffer exactly as it is returned from the server.
httpSubmitConvert If the data being returned from the server is textual, it is automatically converted so that the end of line character sequence is compatible with the Windows platform. Individual carriage return or linefeed characters are converted to carriage return/linefeed character sequences. Note that this option does not have any effect on the form data being submitted to the server, only on the data returned by the server.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

Remarks

The SubmitForm method submits the current form data to a script on the server and returns the result in a string or byte array provided by the caller. This method will cause the current thread to block until the operation completes, a timeout occurs or the post is canceled. During the operation, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

Example

HttpClient1.CreateForm "/login/php", httpMethodPost, httpFormEncoded
HttpClient1.AddField "UserName", strUserName
HttpClient1.AddField "Password", strPassword

nError = HttpClient1.SubmitForm(strResult)
If nError > 0 Then
    MsgBox HttpClient1.LastErrorString, vbExclamation
    Exit Sub
End If

See Also

AddField Method, AddFile Method, CreateForm Method, DeleteField Method, SubmitForm Method