About GridTableStylesCollection problem

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Dear All :

I have a problem about define property GridTableStylesCollection in
usercontrol.

The code show as follow :
Public Property StylesCollector() As GridTableStylesCollection
Set(ByVal Value As GridTableStylesCollection)
_GridStyleCollection= Value
End Set

Get

StylesCollector = _GridStyleCollection
End Get
End Property
where _GridStyleCollection is a friend type of GridTableStylesCollection
however, when I use windows form to out this control onto the form the
property of control StylesCollector show empty also the member in property
windows always show empty even I have add object in it.
The problem shown as attachment

any idea to fix this problem ?

Thanks
 
Hi,

Usually the get comes before the set in the property. You also we
returning the stylecollection wrong. Here is a real simple user control
with a stylecollection.

Public Class Class1
Inherits UserControl

Private _GridStyleCollection As GridColumnStylesCollection


Public Property StylesCollector() As GridColumnStylesCollection
Get
Return _GridStyleCollection
End Get
Set(ByVal Value As GridColumnStylesCollection)
_GridStyleCollection = Value
End Set
End Property

End Class

Ken
 
Thanks for your advice.

However, I have copy your script into test my project

The code is that :
Imports System.Windows.Forms
Public Class MilesBox
Inherits System.Windows.Forms.UserControl
Private _GridStyleCollection As GridTableStylesCollection


Public Property StylesCollector() As GridTableStylesCollection
Get
Return _GridStyleCollection
End Get
Set(ByVal Value As GridTableStylesCollection)
_GridStyleCollection = Value
End Set
End Property
end class



Then I create a new project and new vb form. I drag-drop the usercontrol
(milesbox) into the form. I click the milesbox and right click the property.
Find the StylesCollector
The value is still show nothing or empty (I know the normal case should show
"collection" on bold fonts). It show a small button caption as "..." I
click this button and try to add value in this collection. After edit and
click ok. The collection properties windows then close. But The value is
still show nothing or empty.


Anythings I miss to do ?


Thanks for your experts help


Michael Yip
VB.Net Beginner Developer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top