Can't scan for BLE devices.


  • 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)

    Selasa, 15 Mei 2018 04.40

Semua Balasan

  • 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.

    Selasa, 15 Mei 2018 16.45
  • 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

    Rabu, 16 Mei 2018 06.26