Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

bluetooth connection in c#

zakir123zakir123 pakistanMember Posts: 1

have idea??

Comments

  • Priyasha SarmahPriyasha Sarmah Member Posts: 14

    For establishing connection with another device in bluetooth we need to add that device in our OS .To do that, we have to write the code:
    void adddevice()
    {
    try
    { //add device n os
    Process p=Process.Start("E:\Windows\System32\DevicePairingWizard.exe");//here write ur own windows drive
    while (true)
    {
    if (p.HasExited) //determine if process end
    break;
    }
    //generate busy com ort list

                List tList = new List();
               listBox1.Items.Clear();
             foreach (string s in SerialPort.GetPortNames())
                {
                 tList.Add(s);
                }
                tList.Sort();
          listBox1.Items.Add("NO PORT");
          listBox1.Items.AddRange(tList.ToArray());
         listBox1.SelectedIndex = 0;
    

    richTextBox1.Text = richTextBox1.Text + Environment.NewLine + "COMPORT GENERATED";
    }
    catch (Exception ee)
    { if(DialogResult.Retry== MessageBox.Show("CANT FIND UR ADDED DEVICE..", "Problem occured", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error))
    adddevice();
    }
    }
    For help, visit : http://knowledgetpoint.com/csharp/

Sign In or Register to comment.