Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

user control property value

Posted on 2004-08-25
6
227 Views
Last Modified: 2010-04-23
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.

0
Comment
Question by:Hamdan
  • 3
6 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11892903
maybe an array of strings

    Public Property field_names() As String()
        Get

        End Get
        Set(ByVal Value As String())

        End Set
    End Property

0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11893011
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
0
 

Author Comment

by:Hamdan
ID: 11893300
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 !
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 11893797
Ok, I understand what you mean, so what you really want is to dynamically build an enum type.
This is possible but not simple you have to use the enumbuilder class in
system.reflection.emit.enumbuilder, look here for an example

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemreflectionemitenumbuilderclasstopic.asp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question