Click here to Skip to main content
Click here to Skip to main content

Bluetooth Connection in Windows Mobile 5.0 using InThehand - C#

, 28 Jun 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
Bluetooth connection in Windows Mobile 5.0


This article discusses how Windows Mobile 5.0 devices can connect through the bluetooth using InTheHand DLL in C#.

Setting Bluetooth Discoverable in Windows Mobile

We need to set our mobile as bluetooth discoverable. In Bluetooth settings, you will check the discoverable option.


In Compact framework 1.0, we don't have any managed class which handles bluetooth socket connections. InTheHand is a third party component which gives the functionalities of bluetooth services for windows mobile. You can download InTheHand from here.

Using the Code

The source code is available for download from the link at the top of this article. The devices are displayed in a combobox when we click the first button name of Search devices. Then we can connect the selected device from the combobox by clicking the button named Connect.

The code is noted below which is used in the project.

// Directives.
using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Sockets;
private BluetoothClient bluetoothClient;
private Guid service = BluetoothService.DialupNetworking; 
//Search the devices and displaying in combobox.
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
bluetoothClient = new BluetoothClient();
Cursor.Current = Cursors.WaitCursor;
BluetoothDeviceInfo[] bluetoothDeviceInfo = { };
bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10);
comboBox1.DataSource = bluetoothDeviceInfo;
comboBox1.DisplayMember = "DeviceName"; 
comboBox1.ValueMember = "DeviceAddress";
Cursor.Current = Cursors.Default;
//Connect the selected device.
bluetoothClient.Connect(new BluetoothEndPoint
	((BluetoothAddress)comboBox1.SelectedValue, service));


This will be helpful for working in Windows mobile using C#. Hereafter, we can do something via bluetooth with two Windows mobile devices.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
Hi Viewers,

I wish to all. This is Vinoth. This is where I try to condense everything that you need to know about me.
visit my blog

I'm passionate about a great many things and continually learning about the things that interest me. They are wearable computers, User Interface Design, Artificial life, Industrial music.



Comments and Discussions

Questionclarification PinmemberMember 114193722-Feb-15 1:06 
Questionreceiving data from a sensors PinmemberMilan126-May-13 1:19 
SuggestionWhy NullReferenceException? PinmemberWalter Luiz Rogerio30-Nov-12 13:55 
QuestionWhy NullReferenceException? Pinmemberroby58211-Sep-09 1:15 
AnswerRe: Why NullReferenceException? PinmemberGus Arik13-Sep-09 20:20 
QuestionHow to send a file after connecting Pinmemberwindvp29-May-09 1:07 
AnswerRe: How to send a file after connecting PinmemberS.Vinothkumar29-May-09 20:57 
GeneralRe: How to send a file after connecting Pinmemberfardins20-Dec-10 23:56 
GeneralBluetooth Detection and Data ransfer PinmemberPradip P Thakare5-May-09 1:05 
GeneralTransmitting Text Message to another Bluetooth Device Pinmembermahmoud ankeer14-Apr-09 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150326.1 | Last Updated 28 Jun 2007
Article Copyright 2007 by S.Vinothkumar
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid