agieli 0 Newbie Poster

i'm new in C#,but i have been trying to write a simple program for a start,just to search for bluetooth devices in an area.but i would like it to be able to send texts to the detected devices and be able to receive texts from the devices.

i'm stuck sending texts.anyone out there to give me a hand or suggestions?

below is the simple code i have written.

many thanx

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using InTheHand.Net.Bluetooth;

namespace windowsBluetooth
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void listOfBluetoothDevices_SelectedIndexChanged(object sender, EventArgs e)
    {
        //if the device is selected,show the device's Nap
        if (listOfBluetoothDevices.SelectedItem != null)
        {
            Device device = (Device)listOfBluetoothDevices.SelectedItem;
            textBox1.Text = device.Nap.ToString();

        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        connection.Visible = true;
        connectionstrength.Visible = true;
        label1.Visible = true;
        textBox1.Visible = true;
        receiveTxt.Visible = true;
        receiveMessage.Visible = true;
        sendId.Visible = true;
        connectionstrength.Visible = Visible;


    }


    private void Form1_Load(object sender, EventArgs e)
    {
        connection.Visible = false;
        connectionstrength.Visible = false;
        label1.Visible = false;
        textBox1.Visible = false;
        receiveTxt.Visible = false;
        receiveMessage.Visible = false;
        sendId.Visible = false;
        connectionstrength.Visible = false;

    }

    private void connection_Click(object sender, EventArgs e)
    {
        //search for devices
        List<Device> devices = new List<Device>();
        InTheHand.Net.Sockets.BluetoothClient bc = new InTheHand.Net.Sockets.BluetoothClient();
        InTheHand.Net.Sockets.BluetoothDeviceInfo[] array = bc.DiscoverDevices();
        int count = array.Length;

        for (int i = 0; i < count; i++)
        {
            Device device = new Device(array[i]);
            devices.Add(device); 
        }

    } 
}

}