G
Guest
In propertyGrid1_PropertyValueChanged event, I want to know the changedItem's parent
For example, the changed item is Bold, its parent is Font. But how could I get the Font GridItem
I tried to use these codes
0->private void propertyGrid1_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e
1->
2-> GridItem item = e.ChangedItem
3-> if(item.Parent!=null
4->
5-> this.label1.Text = item.Parent.Label
6->
7-> els
8-> this.label1.Text = "null"
9->
But there will throw an exception at Line 3
The exception i
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dl
Additional information: Cannot access a disposed object named "The GridItem has been disposed and is no longer usable."
Then I changed the codes at Line 2 like this
GridItem item = this.propertyGrid1.SelectedGridItem
The exception also be thrown
Who can tell me why and if I really need to get the GridItem's parent. How could I do?
For example, the changed item is Bold, its parent is Font. But how could I get the Font GridItem
I tried to use these codes
0->private void propertyGrid1_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e
1->
2-> GridItem item = e.ChangedItem
3-> if(item.Parent!=null
4->
5-> this.label1.Text = item.Parent.Label
6->
7-> els
8-> this.label1.Text = "null"
9->
But there will throw an exception at Line 3
The exception i
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dl
Additional information: Cannot access a disposed object named "The GridItem has been disposed and is no longer usable."
Then I changed the codes at Line 2 like this
GridItem item = this.propertyGrid1.SelectedGridItem
The exception also be thrown
Who can tell me why and if I really need to get the GridItem's parent. How could I do?