Click here to Skip to main content
14,982,954 members
Articles / Mobile Apps
Posted 28 Jun 2007


47 bookmarked

Bluetooth Connection in Windows Mobile 5.0 using InThehand - C#

Rate me:
Please Sign up or sign in to vote.
2.91/5 (6 votes)
28 Jun 2007CPOL
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 Pin
Member 114193722-Feb-15 0:06
MemberMember 114193722-Feb-15 0:06 
Questionreceiving data from a sensors Pin
BlueRockDevil6-May-13 0:19
MemberBlueRockDevil6-May-13 0:19 
SuggestionWhy NullReferenceException? Pin
WLRoger30-Nov-12 12:55
MemberWLRoger30-Nov-12 12:55 
QuestionWhy NullReferenceException? Pin
roby58211-Sep-09 0:15
Memberroby58211-Sep-09 0:15 
AnswerRe: Why NullReferenceException? Pin
Gus Arik13-Sep-09 19:20
MemberGus Arik13-Sep-09 19:20 
me too have found that error..

how to fixed it??
QuestionHow to send a file after connecting Pin
windvp29-May-09 0:07
Memberwindvp29-May-09 0:07 
AnswerRe: How to send a file after connecting Pin
S.Vinothkumar29-May-09 19:57
MemberS.Vinothkumar29-May-09 19:57 
GeneralRe: How to send a file after connecting Pin
fardins20-Dec-10 22:56
Memberfardins20-Dec-10 22:56 
GeneralBluetooth Detection and Data ransfer Pin
Pradip P Thakare5-May-09 0:05
MemberPradip P Thakare5-May-09 0:05 
GeneralTransmitting Text Message to another Bluetooth Device Pin
mahmoud ankeer14-Apr-09 22:14
Membermahmoud ankeer14-Apr-09 22:14 
GeneralCode in C# for data transfer between mobile and pc Pin
MalvikaBahl26-Jan-09 19:46
MemberMalvikaBahl26-Jan-09 19:46 
GeneralTo send some text to bluetooth printer for printing using InThehand dll Pin
Awaneesh Pandey24-Oct-07 22:42
MemberAwaneesh Pandey24-Oct-07 22:42 
QuestionAn error occur Pin
ChunrenHu9-Oct-07 0:19
MemberChunrenHu9-Oct-07 0:19 
AnswerRe: An error occur Pin
desenfoque21-Apr-10 8:48
Memberdesenfoque21-Apr-10 8:48 

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

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