我有以下代码来展开所有PropertyGrid项目,我仍然无法理解这个错误意味着什么:
变量'g'隐藏了一个封闭块中的变量。
如何更正此错误?
Dim Root As GridItem = PropertyGrid1.SelectedGridItem
While Root.Parent IsNot Nothing
Root = Root.Parent
End While
If Root IsNot Nothing Then
Dim odd As Boolean = False
For Each g As GridItem In Root.GridItems
g.Expanded = odd
odd = Not odd
Next
End If