Sample code for 30+ languages & platforms
VB.NET

Clear All Multipart Parts

See more REST Examples

Demonstrates Rest.ClearAllParts, which removes all multipart subparts from the request under construction.

Background. Clearing the parts is useful when reusing the same Rest object to build a different multipart request.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim rest As New Chilkat.Rest
Dim bTls As Boolean = True
Dim bAutoReconnect As Boolean = True
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = False) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


'  Build a part.
rest.PartSelector = "1"
success = rest.SetMultipartBodyString("value1")
If (success = False) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


'  Remove all multipart subparts from the request under construction, for example before reusing the
'  same Rest object for a different multipart request.
rest.ClearAllParts()

Debug.WriteLine("All multipart parts cleared.")