Saleha Ejaz

Saleha Ejaz

  • NA
  • 1
  • 892

TPLINK MODEL NO MA180 is not connected to the port

May 31 2015 12:24 PM
I have a send sms application and  it works fine with the mobiles phones which comes with PC Suit case , but when i Connect TPLINK MODEL NO MA 180 it is not showing the port and gives error as below "ERROR WHILE CONNECTION TO GSM PHONE MODEM " 
 
private void button9_Click(object sender, EventArgs e)
{
//Setting the column grid for fetched data
dataGridView3.ColumnCount = 5;
dataGridView3.Columns[0].Name = "COM Port";
dataGridView3.Columns[1].Name = "Connected Device";
dataGridView3.Columns[2].Name = "Max Baud Rate";
dataGridView3.Columns[3].Name = "Time Out";
dataGridView3.Columns[4].Name = "Status";
dataGridView3.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
try
{
Cursor.Current = Cursors.WaitCursor;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_SerialPort");
foreach (ManagementObject queryObj in searcher.Get())
{
if (queryObj != null)
{
object captionObj = queryObj["DESCRIPTION"];
object capdeviceid = queryObj["DEVICEID"];
object MaxBaudRate = queryObj["MAXBAUDRATE"];
object connstatus = queryObj["STATUS"];
string timeoutsec = "100";
dataGridView3.Rows.Add(capdeviceid, captionObj, MaxBaudRate, timeoutsec, connstatus);
}
}
}
catch (Exception e15)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e15.Message);
}
Cursor.Current = Cursors.Default;
button9.Enabled = false;
button10.Enabled = true;
}
is there any reference or namespace missed for using the root/CIMV2 below are the namespaces added into my project 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using GsmComm.GsmCommunication;
using GsmComm.Interfaces;
using GsmComm.PduConverter;
using GsmComm.Server;
using System.IO;
using System.Data.OleDb;
using System.Management;
using System.Data.SqlClient;