Hamdan
asked on
user control property value
Hi experts ,
I am creating a user control , this control has a combobox , this combo box will display a lookup field in the database , the user control will has a set of properties that I will add , like db_type,db_name ,table _name , field_name . The property of db_type will has list of values (Access,SqlServer,Oracle) . I do tis property with this code :
Public Enum en
Access
SqlServer
Oracle
End Enum
ReadOnly Property db_type() As en
Get
End Get
End Property
so I give the db_type property the type of en.
the problem now , I want to write another property which is field_name which will also display a list of field names depends on the table_name . But I do not know what is the type of the property field_name , because it will have a list of data . and I can not use the enum , because it is a constant type . And the field list is dynamic depending on the table_name property.
I am creating a user control , this control has a combobox , this combo box will display a lookup field in the database , the user control will has a set of properties that I will add , like db_type,db_name ,table _name , field_name . The property of db_type will has list of values (Access,SqlServer,Oracle) . I do tis property with this code :
Public Enum en
Access
SqlServer
Oracle
End Enum
ReadOnly Property db_type() As en
Get
End Get
End Property
so I give the db_type property the type of en.
the problem now , I want to write another property which is field_name which will also display a list of field names depends on the table_name . But I do not know what is the type of the property field_name , because it will have a list of data . and I can not use the enum , because it is a constant type . And the field list is dynamic depending on the table_name property.
or maybe
Dim _datacol As DataColumnCollection
Dim _tbl As DataTable
Public Property tbl() As DataTable
Get
Return _tbl
End Get
Set(ByVal Value As DataTable)
_tbl = Value
datacol = _tbl.Columns
End Set
End Property
Public Property datacol() As DataColumnCollection
Get
Return _datacol
End Get
Set(ByVal Value As DataColumnCollection)
_datacol = Value
End Set
End Property
Dim _datacol As DataColumnCollection
Dim _tbl As DataTable
Public Property tbl() As DataTable
Get
Return _tbl
End Get
Set(ByVal Value As DataTable)
_tbl = Value
datacol = _tbl.Columns
End Set
End Property
Public Property datacol() As DataColumnCollection
Get
Return _datacol
End Get
Set(ByVal Value As DataColumnCollection)
_datacol = Value
End Set
End Property
ASKER
No no , nothing of this code will give me a property with list of values . Array and collection types will not make the value of the propery as list !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Public Property field_names() As String()
Get
End Get
Set(ByVal Value As String())
End Set
End Property