ComponentSpace Professional .NET and ActiveX components for developers
ComponentSpace Home | Products | Downloads | Support | Purchase | Services | About Us
 

Code Samples

The product includes numerous VB.NET, C# and ASP.NET sample applications. All samples include complete source code. For more detailed sample code please refer to the sample applications.


Looking up Who Is Information

Listing 1 demonstrates using the asynchronous BeginLookup method to receive the information from the Who Is server. The OnLookupCompleted event is fired once the information is received from the server or if an error occurs. Alternatively, the synchronous Lookup method may be used.



Private whoIsClient As WhoIsClient

Private Sub StartLookup()
    ' Start the lookup.
    Try
        whoIsClient = New WhoIsClient(comboBoxServerAddress.Text)
    Catch exception As Exception
        MessageBox.Show("The server address is invalid." + _
            Environment.NewLine + exception.Message, _
            "Test Who Is", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Exit Sub
    End Try

    whoIsClient.SynchronizingObject = Me
    AddHandler whoIsClient.LookupCompleted, AddressOf OnLookupCompleted
    whoIsClient.BeginLookup(textBoxQuery.Text)
End Sub

Private Sub OnLookupCompleted(ByVal sender As Object, _
                              ByVal e As LookupCompletedEventArgs)
    If whoIsClient Is Nothing Then Exit Sub

    ' Display the results of the lookup.
    Try
        textBoxResults.Text = whoIsClient.EndLookup(e.AsyncResult)
    Catch exception As Exception
        MessageBox.Show("The lookup failed." + _
            Environment.NewLine + exception.Message, _
            "Test Who Is", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try

    StopLookup()
End Sub
									

Listing 1 Looking up Who Is information