Design Review
Welcome to Autodesk’s Design Review Forums. Share your knowledge, ask questions, and explore popular Design Review topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"NullReferenceException was unhandled" error in VB.NET

5 REPLIES 5
Reply
Message 1 of 6
mauroanzola
2692 Views, 5 Replies

"NullReferenceException was unhandled" error in VB.NET

This Routine in VB6 is working : 

   

Private Sub Aggiorna_Stato()
        Dim CompositeViewer As AdCommon.IAdECompositeViewer3
        Dim Section As ECompositeViewer.IAdSection
        Dim MyObjects As AdCommon.IAdCollection, MyObjectProperties As AdCommon.IAdCollection
        Dim MyObjectsNamedCollection As AdCommon.IAdUserCollection
        Dim ObjectContent As ECompositeViewer.IAdContent
        Dim MyObject As ECompositeViewer.IAdObject
        Dim MyObjectProperty As AdCommon.IAdProperty
        Dim Commands As AdCommon.IAdCollection
        Dim SectionType As ECompositeViewer.IAdSectionType
        CompositeViewer = AxCExpressViewerControl1.ECompositeViewer
        Commands = CompositeViewer.Commands
        Commands.Item("ISOLATE").Enabled = True
        Section = CompositeViewer.Section
        SectionType = Section.SectionType
        ObjectContent = Section.Content
        MyObjectsNamedCollection = ObjectContent.CreateUserCollection
        MyObjects = ObjectContent.Objects(0) '0 is to return all objects
        ObjectContent.Objects(1) = MyObjectsNamedCollection
        For Each MyObject In MyObjects
            MyObjectProperties = MyObject.Properties
            For Each MyObjectProperty In MyObjectProperties
                '
                ' DO SOMETHING
            Next
        Next
    End Sub

In Vb.net generate this error:

1276i062120419681AD1E

5 REPLIES 5
Message 2 of 6
herbert.he
in reply to: mauroanzola

Thank you for your question.

 

Please insure DWF/x file loading succeed before you invoking this code.

 

Any further questions please let me know.



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 3 of 6
mauroanzola
in reply to: mauroanzola

I use Visual Studio 2008 (VB) with ADR 2010.

When i launch program i receive many errors of this type:

 

System.Windows.Data Error: 39 : BindingExpression path error: 'QuickAccessToolBar' property not found on 'object' ''ComponentSettings' (HashCode=31307802)'. BindingExpression:Path=QuickAccessToolBar.Theme.CurrentBrush; DataItem='ComponentSettings' (HashCode=31307802); target element is 'Border' (Name=''); target property is 'Background' (type 'Brush')

System.Windows.Data Error: 39 : BindingExpression path error: 'Id' property not found on 'object' ''RibbonPanel' (HashCode=25039667)'. BindingExpression:Path=Id; DataItem='RibbonPanel' (HashCode=25039667); target element is 'RibbonPanelControl' (Name=''); target property is 'AutomationId' (type 'String')

System.Windows.Data Error: 39 : BindingExpression path error: 'Id' property not found on 'object' ''RibbonPanel' (HashCode=25039667)'. BindingExpression:Path=Id; DataItem='RibbonPanel' (HashCode=25039667); target element is 'DockPanel' (Name='PART_OuterDockPanel'); target property is 'AutomationId' (type 'String')

Message 4 of 6
nestor0423
in reply to: herbert.he

"Please insure DWF/x file loading succeed before you invoking this code."

 

how this can be achieved in using c#?

Message 5 of 6
herbert.he
in reply to: mauroanzola

Thank you for your question.

 

Please monitor the event ViewerEvents.OnEndLoadItem. This event gets fired after the Dwf Viewer control is loaded, and after a DWF file is loaded in the canvas.

 

Any further questions please let me know.

 

Thanks,

-Herbert



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 6 of 6
walshmagger
in reply to: herbert.he

The NullReferenceException is designed as a valid runtime condition that can be thrown and caught in normal program flow. It indicates that you are trying to access member fields, or function types, on an object reference that points to null. That means the reference to an Object which is not initialized. More about...NullpointerException

 

Walsh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report