Can't scan for BLE devices. RRS feed

  • Question

  • This is my code to scan for nearby Bluetooth devices. However, I cannot scan for BLE devices. Can anybody help me with the coding to enable it to scan for BLE devices?

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using DarrenLee.Bluetooth;
    using InTheHand.Net.Bluetooth;
    using InTheHand.Net.Sockets;
    using InTheHand.Net.Ports;
    using System.Threading;
    namespace WindowsFormsApp1
      public partial class Form1 : Form
        List<string> items;
        public Form1()
          items = new List<string>();
          txtStatus.Text = "Waiting....";
        private void btnSearch_Click(object sender, EventArgs e)
          txtStatus.Text = "Scanning...";
        private void startScan()
          listBox1.DataSource = null;
          Thread bluetoothScanThread = new Thread(new ThreadStart(scan));
        private void scan()
          BluetoothClient client = new BluetoothClient();
          BluetoothDeviceInfo[] devices = client.DiscoverDevicesInRange();
          foreach (BluetoothDeviceInfo d in devices)
       private void updateDeviceList()
          Func<int> del = delegate ()
            listBox1.DataSource = items;
            return 0;
       private void listBox1_DoubleClick(object sender, EventArgs e)

    • Moved by Fei Hu Wednesday, May 16, 2018 6:27 AM Third party library related
    Tuesday, May 15, 2018 4:40 AM

All replies

  • You're using several third-party libraries here.  I don't know which module you're actually using, but you'll need to check their documentation.  InTheHand certainly has a BluetoothLE scanner similar to their regular Bluetooth scanner.

    Microsoft also has BLE support built-in.  You don't really need the third-party libraries:


    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Tuesday, May 15, 2018 4:45 PM
  • Hello yann123,

    Your question is more related to third party libraries, you need to repost a new thread to InTheHand forum for better support.


    If you have some grammar or code errors in .Net framework, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Neil Hu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 16, 2018 6:26 AM