Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Snmp getResponse in a DataGrid


Snmp getResponse in a DataGrid

Reply
  #1 (permalink)  
Old 07-16-11, 09:35 AM
Madiha Madiha is offline
New Member
 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Snmp getResponse in a DataGrid

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 ..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?

Code:
    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
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting DataGrid Issue LittlBUGer ASP.NET 11 10-16-06 10:39 AM
ASP.NET datagrid Help cmitty ASP.NET 0 03-22-05 10:12 AM
Help - Datagrid problem with "linefeed"/carriage return zissorbobo Windows .NET Programming 1 03-02-05 09:21 AM
Retrieve a list of value from a datagrid. MistyJoy Visual Basic 0 01-05-05 08:02 PM


All times are GMT -5. The time now is 01:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.