?
Solved

user control property value

Posted on 2004-08-25
6
Medium Priority
?
240 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
[X]
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
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 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