Length:Error:Cannot Obtain Value

Jul 20 2006 9:36 AM
Hi,

I have coding in VB.NET such as in the below :
======================================================================================================
Module A
Private m_IncomingTransmitter As IncomingTransmitter
 
Public Sub incomingMessage(ByVal strIncomingTransmitterXML As String)
      
        Dim strBufferXML As String
        Dim colContent As Collection
        Dim colPacket As Collection
 
        m_IncomingTransmitter = New IncomingTransmitter
       Try
     '--Parse IncomingTransmitterXML
     If parseIncomingXML(strIncomingTransmitterXML, m_IncomingTransmitter) = 0 Then
          'save to temp xml
          insert_xml_temporary(m_IncomingTransmitter.m_ContentHeader.strTrxID, strIncomingTransmitterXML)
     end if

 Catch ex As Exception
            'WriteLog("Transmitter-incomingMessage()")
            Err.Clear()
        Finally
            colContent = Nothing
            colPacket = Nothing
            m_IncomingTransmitter = Nothing
        End Try
end sub
 
end Module
'=======================================================================================
Module B
 
    Structure ContentHeader
        Public strHeaderXML As String
        Public strTrxID As String
        Public strCPpassword As String
        Public strDeliveryChannel As String
    End Structure
 
    Structure ContentCharging
        Public strChargingXML As String
        Public strDeliveryChannel As String
        Public strMessage As String
    End Structure
 
    Structure ContentNotify
        Public strNotifyXML As String
        Public strDeliveryChannel As String
        Public strMessage As String
    End Structure
 
    Structure ContentMessageList
        Public strContentMessageListXML As String
        Public strDeliveryChannel As String
        Public colContentMessage As Collection
    End Structure
 
    Structure IncomingTransmitter
        Public isDedication As Boolean
        Public isChargingAvl As Boolean
        Public isNotifyAvl As Boolean
        Public isDedicationNotifyAvl As Boolean
        Public isContentAvl As Boolean
        Public m_ContentHeader As ContentHeader
        Public m_ContentCharging As ContentCharging
        Public m_ContentNotify As ContentNotify
        Public m_DedicationContentNotify As ContentNotify
        Public m_ContentMessageList As ContentMessageList
    End Structure
 
 Public Function parseIncomingXML(ByVal strXML As String, ByRef m_IncTransmitter As IncomingTransmitter) As Integer
  Dim objXMLDoc As System.Xml.XmlDocument
  Dim objNodeList As System.Xml.XmlNodeList
  Dim objNode As System.Xml.XmlNode
  Dim objNodeListChild As System.Xml.XmlNodeList
  Dim objNodeChild As System.Xml.XmlNode
  Dim objNodeChild1 As System.Xml.XmlNode
  Dim objNodeChild2 As System.Xml.XmlNode
  Dim xmlerr As System.Xml.XmlException
 
  Try
   objXMLDoc = New System.Xml.XmlDocument
 
   objXMLDoc.LoadXml(strXML)
   objNodeList = objXMLDoc.GetElementsByTagName("content_message")
 
   m_IncTransmitter.m_ContentMessageList.colContentMessage = New Collection
 
   For Each objNode In objNodeList
    Dim m_ContentMessage As Collection
    Dim m_Message As Collection
    m_ContentMessage = New Collection
    m_Message = New Collection
 
    objNodeListChild = objNode.SelectNodes("message/data")
    For Each objNodeChild In objNodeListChild
     Dim m_data As Collection
     m_data = New Collection
     If objNodeChild.Attributes.Count = 3 Then
        If Not IsDBNull(objNodeChild.Attributes("pkt").Value) Then m_data.Add(objNodeChild.Attributes("pkt").Value, "pkt")
        If Not IsDBNull(objNodeChild.Attributes("charge").Value) Then m_data.Add(objNodeChild.Attributes("charge").Value, "charge")
         If Not IsDBNull(objNodeChild.Attributes("msg").Value) Then m_data.Add(objNodeChild.Attributes("msg").Value, "msg")
     Else
        If Not IsDBNull(objNodeChild.Attributes("pkt").Value) Then m_data.Add(objNodeChild.Attributes("pkt").Value, "pkt")
        If Not IsDBNull(objNodeChild.Attributes("msg").Value) Then m_data.Add(objNodeChild.Attributes("msg").Value, "msg")
     End If
     m_Message.Add(m_data)
    Next
 
    m_ContentMessage.Add(m_Message, "message")
    m_ContentMessage.Add(objNode.SelectSingleNode("app_id").InnerText, "app_id")
    m_ContentMessage.Add(objNode.SelectSingleNode("total_packet").InnerText, "total_packet")
 
    m_IncTransmitter.m_ContentMessageList.colContentMessage.Add(m_ContentMessage)
 
    m_ContentMessage = Nothing
    m_Message = Nothing
    m_data=nothing
   Next
  Catch ex As Exception
       Err.Raise(9999, Err.Source, "Error-Parsing XML: " & ex.Message & " XML: " & Replace(strXML, vbCrLf, ""))
       parseIncomingXML = Err.Number
       Err.Clear()
  Finally
      objXMLDoc = Nothing
      objNodeList = Nothing
      objNode = Nothing
      objNodeChild1 = Nothing
      objNodeChild2 = Nothing
  End Try
 end function
 
end Module
'===========================================
After execute this command line, got error occurs.
       If parseIncomingXML(strIncomingTransmitterXML, m_IncomingTransmitter) = 0 Then
 
If I check a value using add-watch, a value from m_incomingTransmitter. m_contentMessageList displayed error message "Length=Error:Cannot Obtain Value".

But if I have check in the inside of procedure still got a value (0 or 1)
 
If I search using google, any advice to have changes using CLASS. But, if I did, still got that error.
Please, give an advice.
 
Thanks a lot.

regards,
Johan Wijaya