Design Review

Design Review

Reply
Active Member
mauroanzola
Posts: 8
Registered: ‎09-09-2010
Message 1 of 5 (1,141 Views)

"NullReferenceException was unhandled" error in VB.NET

1141 Views, 4 Replies
10-19-2010 09:19 AM

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

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 2 of 5 (1,127 Views)

Re: "NullReferenceException was unhandled" error in VB.NET

10-20-2010 02:11 AM 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.
Active Member
mauroanzola
Posts: 8
Registered: ‎09-09-2010
Message 3 of 5 (1,115 Views)

Re: "NullReferenceException was unhandled" error in VB.NET

10-20-2010 06:00 AM 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:smileytongue:ath=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:smileytongue:ath=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:smileytongue:ath=Id; DataItem='RibbonPanel' (HashCode=25039667); target element is 'DockPanel' (Name='PART_OuterDockPanel'); target property is 'AutomationId' (type 'String')

Contributor
nestor0423
Posts: 22
Registered: ‎05-06-2010
Message 4 of 5 (1,015 Views)

Re: "NullReferenceException was unhandled" error in VB.NET

11-11-2010 04:01 AM 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#?

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 5 of 5 (1,000 Views)

Re: "NullReferenceException was unhandled" error in VB.NET

11-11-2010 06:44 PM 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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.