473,503 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

enum 'expansion' / 'extention'

Not sure what to call this, but I have a series of User Controls that
display the days of the week. Usually using a set of radio buttons. Works
very well.

I display the user controls in a form and typically allow the user to select
only a single day within a single week. There are at times, up to 8 weeks
displayed, but the user is allowed only one day to be selected across all
controls. As the use clicks on a radio button, all other buttons on all
other user controls are cleared. I am doing this by fireing an event from
the control to the windows form. Again, works very well.

I use the 'System.DayOfWeek' enumeration to get and set the value of the
control. I even use this enumeration in the even on the control that is
fired when the user changed the selection. Again works very well.

Now, I would like to add a state that has no selection on the control. I am
currently doing this with an additional Boolean flag, but is there any way
that I can in effect add another value to System.DayOfWeek. This would be
really helpful as I could continue to pass this value around my application
without worrying about conversion.

Or, is this a possible use for nullable types in 2.0?

-Andrew
Nov 16 '05 #1
3 1392
Hi Andrew,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a new null value to the
System.DayOfWeek enumeration. If there is any misunderstanding, please feel
free to let me know.

Currently, we cannot add an enum to the DayOfWeek enumeration. So I think
the best workaround is to add a flag which indicates if the object has
value.

However, in .NET framework 2.0, we'll have nullable types for value types.
You can just declare an object as follows:

Nullable<System.DayOfWeek> a = null;
or
Nullable<System.DayOfWeek> a = DayOfWeek.Sunday;

We can use a.HasValue to check if it is a null value.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #2
thanks, pretty much what I thought all the way around.

-Andrew

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:Zl**************@TK2MSFTNGXA02.phx.gbl...
Hi Andrew,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a new null value to
the
System.DayOfWeek enumeration. If there is any misunderstanding, please
feel
free to let me know.

Currently, we cannot add an enum to the DayOfWeek enumeration. So I think
the best workaround is to add a flag which indicates if the object has
value.

However, in .NET framework 2.0, we'll have nullable types for value types.
You can just declare an object as follows:

Nullable<System.DayOfWeek> a = null;
or
Nullable<System.DayOfWeek> a = DayOfWeek.Sunday;

We can use a.HasValue to check if it is a null value.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #3
You're welcome, Andrew.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #4

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

Similar topics

2
4997
by: Jesper Olsen | last post by:
I have a python extention implemented in C/C++ - the extention itself is internally implemented in C++, but the interface is pure C, so that it can easily be called from a python C-wrapper. The...
0
1829
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to...
1
2583
by: Carl Ogawa | last post by:
How do I make .cgi extention work? I installed ActivePerl 5.8. My CGI scripts work fine with .PL extention but not .CGI extention although I associated CGI extention as exactly same as PL...
1
3067
by: MFA | last post by:
Hi all I have installed Front page server Extention on IIS 5.0 it was working fine. I was able to load project from Visual Interdav and doing well. Yesterday I installed a security update from...
3
1767
by: Tuvas | last post by:
I am currently writing an extention module that needs to recieve a list of characters that might vary in size from 0 to 8. This is written as a list of characters rather than a string because it's...
1
1226
by: Robert Phan | last post by:
I was modified the expansions.xml to learn about expansion snippet. Now I got error when trying to invoke the expansion. Error is "No expansion template were found...". Do I needed to reinstall...
3
4069
by: David A. Osborn | last post by:
I currently have a class that has an enumeration of graphics extensions that it supports ie: Public Enum GraphicFormats JPG JPEG BMP TIFF End Enum
3
12248
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
1
1917
by: Alex Vinokur | last post by:
A program below prints "Second". A preprocessor doesn't know BBB, but it seems that it (preprocessor) uses 0 unstead of BBB. Why doesn't the preprocessor produce error/warning: "BBB is indefined"?...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
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
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
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,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
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
1512
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 ...
0
380
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.