From: Mr. X. on
I don't know if site & displayRectangle always occurs in properties, when
their BrowsableAttribute is Browsable=true.
What make those property unique, so I can check not only by their name, and
delete them from my list, but by some attributes, or something else ?

Thanks :)

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:eQ6eb#MELHA.1868(a)TK2MSFTNGP05.phx.gbl...
> Am 21.06.2010 00:04, schrieb Mr. X.:
>> Great.
>> Now I just have to check this.
>> (Where did you find that documentation ? I want to search this code
>> either).
>> How can I check this (checking the public and attribute. Is my code
>> correct
>> ?)
>
> "Remarks" section, 5th paragraph:
> http://msdn.microsoft.com/en-us/library/system.windows.forms.propertygrid(VS.90).aspx
>
>> Still there are some problems.
>> Specifically for panel, the properties: UseWaitCursor, autoSize,
>> autoSizeMode have the attribute : browsableAttribute, and are shown on
>> design time.
>
> My fault. I did not code what I said. :-) Only checking whether the
> BrowsableAttribute
> is not attached is not sufficient. The property is also included if the
> attribute's
> Browsable is True:
>
> If atts.Length = 0 _
> OrElse DirectCast(atts(0),
> System.ComponentModel.BrowsableAttribute).Browsable Then
>
> Debug.Print(prop.Name)
> End If
>
> This results in 37 properties.
>
>
>> Also there are extra properties, that logically are considered : Site,
>> displayRectangle.
>> [...]
>> msgBox ("k = " & k) ' now k = 34, where it should be
>> 35
>
> If 35 + 2 (Site + displayRectangle) = 37 = correct then it should be the
> right result now.
>
>
> --
> Armin

From: Cor Ligthert[MVP] on
Armin,

I have seen endless times here Herfried replying about the browsable
attribute, and I've almost the same times written that it does not make a
property invisible in a property grid.

I also think it should do that, so I don't know what Net versions that were
and if it is currently doing what you would expect.

At least I was never able to make a public property invisible in the grid.
And then come forever with the sample background from a picturebox, which in
fact does nothing and would be better not in the property grid of the
designer.

Cor

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:O9eRHjLELHA.4316(a)TK2MSFTNGP06.phx.gbl...
> Am 20.06.2010 22:20, schrieb Mr. X.:
>> No.
>> (I have answered the previous thread).
>> As your advise, I did getProperties & getCustomAttributes either :
>> prs = ... getProperties
>> for I = 0 to prs.count - 1
>> dim prop = prs(j)
>> dim atts = prop.GetCustomAttributes
>> for each att in atts ... ' as your code below.
>>
>> .... but I have reach the inner loop only when :specialAtt.Visibility was
>> hidden.
>> (And I don't get all of the properties, that are seen on the designer :
>> properties view).
>>
>> It doesn't meter whether I use a serializable object or using Reflection,
>> but, I see that serializable isn't possible for Panel, I.e, and I didn't
>> understand reflection (I don't know if I should use getProperties method,
>> or
>> getFields method -
>> both don't return the same fields' count as the property grid does on
>> design
>> time).
>
> Your question in this thread is how to run through the properties of an
> object.
> You can do it with reflection, and you know how to do it. I still don't
> understand
> what you can not do with it.
>
> A Panel is not serializable. You have to take it as it is, i.e. you have
> to
> write your own code to write the property values to wherever you want.
>
> 'GetProperties' returns the properties and 'GetField' gets the fields. :-)
> I think the names say it. As you are doing these kinds of tasks, I think
> you
> already know the difference because these are basic terms in OOP:
>
> http://msdn.microsoft.com/en-us/library/exe76ct6(VS.90).aspx
>
> The VB documentation is sometimes more made for dummies (or "beginners")
> than structrued
> very well. Probably therefore, fields are described as part of the
> property explanation:
>
> http://msdn.microsoft.com/en-us/library/8yx6f707(VS.90).aspx
>
>
> --
> Armin
>
From: Armin Zingler on
Am 21.06.2010 10:46, schrieb Mr. X.:
> I don't know if site & displayRectangle always occurs in properties, when
> their BrowsableAttribute is Browsable=true.
> What make those property unique, so I can check not only by their name, and
> delete them from my list, but by some attributes, or something else ?

I don't know what makes them unique or why you think they are unique. They are
properties like others and browsable=true. Therefore they are listed. You can
check all their attributes by calling GetCustomAttributes.

--
Armin
From: Armin Zingler on
Am 21.06.2010 12:23, schrieb Cor Ligthert[MVP]:
> Armin,
>
> I have seen endless times here Herfried replying about the browsable
> attribute, and I've almost the same times written that it does not make a
> property invisible in a property grid.
>
> I also think it should do that, so I don't know what Net versions that were
> and if it is currently doing what you would expect.
>
> At least I was never able to make a public property invisible in the grid.
> And then come forever with the sample background from a picturebox, which in
> fact does nothing and would be better not in the property grid of the
> designer.

I've never used the PpropertyGrid. :-D

I've only read the documentation and counted the # of properties in the
property window in the IDE if I select a picturebox or a panel in the Form
designer.

I don't challenge the whole task every time. ;)


--
Armin
From: Armin Zingler on
Am 21.06.2010 12:19, schrieb Armin Zingler:
> Am 21.06.2010 10:46, schrieb Mr. X.:
>> I don't know if site & displayRectangle always occurs in properties, when
>> their BrowsableAttribute is Browsable=true.
>> What make those property unique, so I can check not only by their name, and
>> delete them from my list, but by some attributes, or something else ?
>
> I don't know what makes them unique or why you think they are unique. They are
> properties like others and browsable=true. Therefore they are listed. You can
> check all their attributes by calling GetCustomAttributes.

I've only shown you the part you've asked for. I don't write the final code.
You should combine my information with what you already have. I guess you've
ignored 'CanWrite' this time. DisplayRectangle is readonly.


--
Armin