Solved

user control property value

Posted on 2004-08-25
6
221 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trying to get PDF to open as "Open,Save,Cancel" instead of as a pop-up. 6 43
Sql server insert 13 31
vb.net winforms sizing/resolution? 4 34
vb.net class 3 17
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

803 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