How to change the node icon in readtime?


#1

Hi there,
In my
Private Sub GoView1_ObjectDoubleClicked(ByVal sender As Object, ByVal e As Northwoods.Go.GoObjectEventArgs) Handles GoView1.ObjectDoubleClicked
I have
if (something) then
mynode.Image.name = “something.ico”
else
mynode.image.name =“else.ico”
end if
I met object disposed exception in the else claue.
How am I suppose to do it?
Thanks.


#2

I assume “mynode” is a GoIconicNode or a GoSimpleNode or a GoGeneralNode, found by looking at e.GoObject.ParentNode and casting it appropriately.
I tried this, using an GoView.ObjectDoubleClicked event handler, replacing the GoImage.Name to refer to image files on disk, and it works just fine.
So you’re getting an exception when setting GoImage.Name? Are there any other details?


#3

Hi Walter,
Thanks for your quick reply. Mynode is a GoGeneralNode. I have serveral nodes in my doc and I am using the resourcemanager.
The exception was thrown out when I try to set the GoImage.Name
mynode.image.name =“else.ico”
In the first time, it will go through. But after the first time, the object disposed exception will be thrown out.
Here is the debug message:
An unhandled exception of type ‘System.ObjectDisposedException’ occurred in system.drawing.dll
Additional information: Cannot access a disposed object named “Icon”.


#4

Precisely what is the version of your assembly? I vaguely remember that there was such a bug in a beta release.
If you are using version 2.1, you should be using baselevel 2.1.2.
If you are still using version 2.0, you should be using baselevel 2.0.1.
The M.N.0 baselevels are normally beta versions.


#5

Thanks a lot.
Problem solved.