Error assigning contents of TextBox to PISDK.PIPoint variable

Discussion created by DevBiker on Jan 26, 2011
Latest reply on Jan 28, 2011 by DevBiker

Hello all!


With the help of a fellow vCampus member, I am trying to get some understanding of working with the PISDK using VB.NET (VS2010).  The following sub generates an error at the highlighted line: 


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If TextBox1.Text = "" Then
        MsgBox("Please enter a tag name.")
        Exit Sub
    End If
    Dim pt As PISDK.PIPoint
    Dim srv As PISDK.Server


    pt = srv.PIPoints(TextBox1.Text)
im piatr As PISDK.PointAttributes


    For Each piatr In pt.PointAttributes


End Sub


The warning is "NullReferenceException was unhandled" with the line below stating "Object reference not set to an instance of an object."


The original code was from VS2008 and I'm using VS2010.  I have OSIsoft.PISDK, OSIsoft.PISDKCommon, and OSIsoft.PISDKDlg references added to the project.  If anyone can assist me, I would appreciate it.