You just need to run BluetoothClient.DiscoverDevices in the background (don't use selectdevicesdialog as that will require popping up the window). There are multiple ways to run things in the background on .NET. One is to use the class I added recently "BluetoothComponent' you can do the following, hopefully you can *read* VB :-):
Public Sub DiscoDevicesAsync()
Dim bco As New BluetoothComponent()
' Or add a VB: Sub BT_DiscoverDevicesComplete(...) HANDLES bco.DiscoverDevicesComplete
AddHandler bco.DiscoverDevicesComplete, AddressOf HandleDiscoDevicesAsync
bco.DiscoverDevicesAsync(255, True, True, True, False, Nothing)
End Sub
///
Private Sub HandleDiscoDevicesAsync(ByVal sender As Object, ByVal e As DiscoverDevicesEventArgs)
If e.Cancelled Then
Console.WriteLine("DiscoDevicesAsync cancelled.")
ElseIf e.Error IsNot Nothing Then
Console.WriteLine("DiscoDevicesAsync error: {0}.", e.Error.Message)
Else
Console.WriteLine("DiscoDevicesAsync found {0} devices.", e.Devices.Length)
End If
End Sub
Download the source file from https://32feet.svn.codeplex.com/svn/InTheHand.Net.Personal/InTheHand.Net.Personal/Net.Bluetooth/BluetoothComponent.cs and add it to your own project. (The next release of the library will have it built-in).
Alan J. McFarlane
http://www.alanjmcf.me.uk/
Please follow-up in the newsgroup for the benefit of all.
Have I helped? Consider visiting my Amazon wishlist, see my homepage.