Click here to Skip to main content
15,845,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm tried to send file from pc to mobile via bluetooth.But it was not working. i'm using the IntheHand.net. dll for bluetooth transmission. But output of my program is BADREQUEST. i tried it lot of time but i was not working.This is my code. Help me please

VB
Private Sub sendbtn_Click(sender As Object, e As EventArgs) Handles sendbtn.Click
        If ListBox1.SelectedIndex = -1 Then
            MessageBox.Show("select the device !", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If

        Dim ofd As New OpenFileDialog()
        ofd.Title = "Select File"
        ofd.Filter = "All Files (*.*)|*.*"
        Try
            If ofd.ShowDialog() = DialogResult.OK Then
                Cursor.Current = Cursors.WaitCursor
                Dim uri As System.Uri = New Uri(("obex://" & ListBox1.SelectedIndex.ToString() & "/") + System.IO.Path.GetFileName(ofd.FileName))
                Dim request As New ObexWebRequest(uri)
                request.ReadFile(ofd.FileName)
                Dim response As ObexWebResponse = DirectCast(request.GetResponse(), ObexWebResponse)
                'MessageBox.Show(response.StatusCode.ToString())
                If response.StatusCode.ToString.Trim = "BadRequest" Then
                    Label7.Text = "Not success"
                    Label7.ForeColor = Color.Red
                ElseIf response.StatusCode.ToString.Trim = "OK, Final" Then
                    Label7.Text = "Success"
                    Label7.ForeColor = Color.LightGreen
                Else
                    Label7.Text = "Error: : " & vbCrLf & _
                    response.StatusCode.ToString.Trim
                End If
                response.Close()
                Cursor.Current = Cursors.[Default]
            End If
        Catch ex As Exception
            MsgBox(Err.Description)
        End Try
        ListBox1.SelectedIndex = -1
    End Sub
Posted
Comments
ZurdoDev 10-Oct-14 8:25am    
How you contacted In The Hand for samples?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900