Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Name Property
Message
From
27/02/2003 14:30:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Name Property
Miscellaneous
Thread ID:
00758969
Message ID:
00758969
Views:
53
I have a Column Class which have a Name Property
I also have a ColumnCollection Class, what i want to do is that every time i add column object to the class, this new object gets by itself the Name of the instance.

example: WSColumn1,WSColumn2,WSColumn3 and so on, how can i do that.

i have a window control in which i add a property ReadOnly that return the ColumnCollection, so in the properties when i add the column objects i would like that the Name Property fill itself with the intance one.

i also would like to validate the name of the property, not to duplicate, i don't want to have two columns in the collection with the same name or an empty name.


i don't know if there is an identifier in the ComponenModel to tell a property have to behave like a Name of an Object.

****************************************************************************
Imports System.ComponentModel

_
Public Class WSColumn
Private blnLocked As Boolean
Private blnButton As Boolean
Private strName As String

"Description("Specifies wether the Column Text can be modified or not."), _
DefaultValue(False)" _
Public Property Locked() As Boolean
Get
Return blnLocked
End Get
Set(ByVal Value As Boolean)
blnLocked = Value
UpdateColumnsBehaviour()
End Set
End Property

"Description("Specifies wether the Column has a button or not."), _
DefaultValue(False)" _
Public Property Button() As Boolean
Get
Return blnButton
End Get
Set(ByVal Value As Boolean)
blnButton = Value
UpdateColumnsBehaviour()
End Set
End Property

"Description("Specifies the Column Width")" _
Public Property Width()
Get
Return msfg.get_ColWidth(msfg.Col)
End Get
Set(ByVal Value)
msfg.set_ColWidth(msfg.Col, Value)
End Set
End Property

"Description("Specifies the Column Text")" _
Public Property Text()
Get
Return msfg.get_TextArray(intColTemp)
End Get
Set(ByVal Value)
msfg.set_TextArray(intColTemp, Value)
End Set
End Property

"Description("Set or returns the name of the Column."), ParenthesizePropertyName(True)" _
Public Property Name() As String
Get
Return strName
End Get
Set(ByVal Value As String)
strName = Value
End Set
End Property
End Class
****************************************************************************

****************************************************************************
Public Class WSColumnCollection
Inherits System.Collections.CollectionBase

Public Sub Add(ByVal aWSColumn As WSColumn)
Dim i As Integer
End Sub

Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!", "WSLibrary", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
List.RemoveAt(index)
End If
End Sub

Public Sub Remove(ByVal index As String)
Dim i As Integer
For i = 1 To Count
If CType(List.Item(i), WSColumn).Name = index Then
Exit For
End If
Next
If i > Count Then
System.Windows.Forms.MessageBox.Show("Name not valid!", "WSLibrary", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
List.RemoveAt(i)
End If
End Sub

Public ReadOnly Property Item(ByVal index As Integer) As WSColumn
Get
Return CType(List.Item(index), WSColumn)
End Get
End Property

Public ReadOnly Property Item(ByVal index As String) As WSColumn
Get
Dim i As Integer
For i = 1 To Count
If CType(List.Item(i), WSColumn).Name = index Then
Exit For
End If
Next

Return CType(List.Item(i), WSColumn)
End Get
End Property
End Class
Reply
Map
View

Click here to load this message in the networking platform