private void connect_Click(object sender, EventArgs e) { IPAddress addr = new IPAddress(m_DeviceAddr); int handle = 0; Cursor.Current = Cursors.WaitCursor; int result = BSSDK.BS_OpenSocket(addr.ToString(), Int32.Parse(port.Text), ref handle); Cursor.Current = Cursors.Default; if (result != BSSDK.BS_SUCCESS) { MessageBox.Show("Cannot connect to the device", "Error"); return; } m_MainForm.AddConnectedDevice(m_DeviceID, m_DeviceType, m_DeviceAddr, handle); }