Adding a Callback Event Handler in VB.NET

Dim “WithEvents” Dim WithEvents ftp As Chilkat.Ftp2 Add some code to create a new instance of the object. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ftp = New Chilkat.Ftp2() ftp.EnableEvents = True ftp.HeartbeatMs = 100 … Select the “ftp” object. Select the event. This causes Visual Studio to generate the event handler function. Add your […]

Is Calling .Dispose() Recommended for C# and VB.NET?

Question: In your examples online, we have noticed that .Dispose() is never called after using Chilkat classes (we are writing in C#). Is calling .Dispose() recommended?  Does your code not need to destroy any native resources or handles that would normally be cleaned up in the Dispose method (the IDisposeable interface) ? Answer: For objects that manage a TCP/IP socket […]

VB.NET HTTP Download with percent-done progress monitoring

Here is an example: Dim WithEvents http As Chilkat.Http Private Sub http_OnPercentDone(ByVal sender As Object, ByVal args As Chilkat.PercentDoneEventArgs) Handles http.OnPercentDone ProgressBar1.Value = args.PercentDone End Sub Private Sub HttpDownloadTest() http = New Chilkat.Http() Dim success As Boolean ‘ Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent(“Anything for 30-day trial”) If (success True) Then MsgBox(http.LastErrorText) Exit Sub […]

VB.NET Compress String to Byte Array

Demonstrates how to use Chilkat.Compression to compress a string to a byte array: Private Sub CompressStringToBytes() Dim compress As New Chilkat.Compression() ‘ Any string argument automatically begins a 30-day trial. Dim success As Boolean success = compress.UnlockComponent(“30-day trial”) If (success <> True) Then MsgBox(“Compression component unlock failed”) Exit Sub End If ‘ Use the “deflate” algorithm, which is the algorithm […]