AddField Method  
 

Add the form field and its value to the current form.

Syntax

object.AddField( FieldName, FieldData, [FieldLength] )

Parameters

FieldName
A string which specifies the name of the field to add to the form.
FieldData
A string or byte array which specifies the data for the form field.
FieldLength
An integer value which specifies the length of the field data in characters or bytes, depending on whether the field data was specified as a string or byte array. If this optional argument is omitted, the complete string or byte array will be used.

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 AddField method is used to add a field and its associated value to a form created using the CreateForm method. If the field name has already been added to the form, the previous value is deleted and replaced by the new value.

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