I want to get the SNMP Getresponse in a datagridview..and i have created a program ..here is the code for getting GetResponse in DataGridView ..
Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
Dim dt As New DataTable()
Dim snmp As New SimpleSnmp
Dim kvp As KeyValuePair(Of Oid, AsnType)
Dim result As Dictionary(Of Oid, AsnType)
dt.Columns.Add(New DataColumn("Column1", GetType(SimpleSnmp)))
dt.Columns.Add(New DataColumn("Column2", GetType(Dictionary(Of Oid, AsnType))))
dt.Columns.Add(New DataColumn("Column3", GetType(KeyValuePair(Of Oid, AsnType))))
Dim dr As DataRow
dr = dt.NewRow()
dr("Column1") = New SimpleSnmp(DataGridView1.Rows(0).Cells(1).Value.ToString, DataGridView1.Rows(3).Cells(1).Value.ToString)
dr("Column2") = snmp.Get(SnmpVersion.Ver1, New String() {DataGridView1.Rows(1).Cells(1).Value.ToString()})
If Not snmp.Valid Then
MessageBox.Show("Invalid hostname/community")
End If
If result IsNot Nothing Then
For Each kvp In result
dr(0) = SnmpConstants.GetTypeName(kvp.Value.Type)
dr(1) = kvp.Key.ToString
dr(2) = kvp.Value.ToString()
Next kvp
Else
MessageBox.Show("No results received")
End If
dt.Rows.Add(dr)
DataGridView2.DataSource = dt
End Sub
I have bind an Array in the datagrid..But the problem is i m not getting any response in datagrid instead i m getting a message box that shows "No results received"..
How can I get my Snmp GetResponse in a datagridView?