after
private void btDestroy_Click(object sender, EventArgs e)
add
private int iPort = 0;
private bool fCreated = false;
change
private void btCreate_Click(object sender, EventArgs e)
as below
private void btCreate_Click(object sender, EventArgs e)
{
wcl.wclBluetoothRadio Radio = GetSelectedRadio();
if (Radio != null)
{
string Address = "(00:1B:C1:04:DF:96)";
wclVirtualCOMPort.Address = Address;
wclVirtualCOMPort.Radio = Radio;
wclVirtualCOMPort.Service = wcl.wclUUIDs.SerialPortServiceClass_UUID;
fCreate = false;
iPort = 0;
while (!fCreated)
{
wclVirtualCOMPort.Open();
Application.DoEvents();
}
MessageBox.Show("Port: " + iPort.Tostring());
}
}
change
private void wclVirtualCOMPort_AfterOpen
as below
private void wclVirtualCOMPort_AfterOpen(object sender, wcl.wclVirtualPortCreatedEventArgs e)
{
if (e.Error == wcl.wclErrors.WCL_E_SUCCESS)
{
iPort = e.Port;
fCreated = true;
}
}
as I told you had to delete wclShowError() call from your code to disable message showing. It is always bad idea to use WCL samples code instead of developing your own application with your own code.