473,498 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

enumeration and how to populate them during runtime

I have a question about enumeration and how to populate them during
runtime.
I am using vb.net but will happily take any advice in c# as well.
Here is an example to help illustrate what I am after.

Create a class named “clsMyItems” and in that class place an enum.
Public Enum Items
Item1 = 0
Item2 = 1
Item3 = 2
End Enum

Now from another class call the Items enum.

Dim MyItems as new clsMyItems

MyItems.Items.

After typing the last dot in “MyItems.Items.” the intellisense will show
a nice drop down list of all the enumerated items in Items. This is
exactly what I am looking for.

Now for the problem…
I don’t know ahead of time what items or how many of them will be listed
in the Items enum. This is just a simplified example of what will
eventually go into a custom control I am working on. If I can get past
this issue it will make the control insanely easy to use.

Is there a way to populate the Items enum at runtime or an equivalent
method that will give me the drop down list I so desperately need.

If it makes a difference, the control inherits from
System.ComponentModel.Component

I could do it as System.Windows.Forms.UserControl but I would prefer to
do it as a component since it will never be seen on any form.
Its primary use is for windows forms but it will be used on web forms
I’m sure.

Nov 22 '05 #1
0 770

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2831
by: dgoel | last post by:
Hi, I Have a text file & I want to open it in excel sheet ( withou importing). I have written code for it, but it is not opening exce sheet. It opens the text file, but does not create a excel...
4
5638
by: Marshal | last post by:
Sure... IEnumerable was inconvenient suggesting a separate class to service the enumeration, IEnumerator, and multiple operations: Current, MoveNext, Reset. (I'll warp the definition of "operation"...
3
10605
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
7
8988
by: Don | last post by:
I need to get the type of an enumeration from an instance of a class. e.g. Public Class MyClass Public Enum MyEnum value1 = 1 End Enum End Class
10
2129
by: MLH | last post by:
My A97 runtime installations are sometimes paused during the install process prompting user with messages saying the files are in use. Generally, I tell them to click IGNORE. Although I haven't...
0
922
by: p | last post by:
I am wirting an applications where I use Roles. My roles are held in an SQL Table where the fields are simply RolID and RoleName. I am writing the Application in ASP.NET. I assign the roles to...
0
1562
by: John Saunders | last post by:
Given a schema as follows: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">...
0
1994
by: Rich | last post by:
Hello, I started using the Reportviewer control (very nice) for generating Reporting Services type reports in my VB2005 app. I have been experimenting using a designer Reportviewer control from...
1
2317
by: PPA | last post by:
Hi Guys I am really new to XML/XSD and Castor. Could you please help me out here? I have following XSD: -----------------------------XSD STARTS----------------------------------- <xs:schema...
1
2423
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
How can I fill an array for each type in OleDbType where column1 is the literal and column 2 is its numeric value as string? BigInt 20 Binary 128 etc. Thanks.
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.