retrieving the XmlEnumAttribute and the enum-values (2)

This post is a followup to the thread "retrieving the XmlEnumAttribute values 
for an Enum" in this same forum earlier this month, since my last query in 
that thread went unanswered.

I have an enum defined (DotNet v2) as 
  public enum velocityUom 
  { [System.Xml.Serialization.XmlEnumAttribute("m/s")] 
    ms = 21, 

    [System.Xml.Serialization.XmlEnumAttribute("cm/a")] 
    cma, 

    ... 
  } 

My original post was to ask how I could retrieve the XmlEnumAttribute values 
for this Enum so that I could create a combo box with values like "m/s", 
"cm/a", ... so that I don't have to hard-code the XML-enum values in my code. 

Oleg Tkachenko answered with the following solution
  Type enumType = typeof(velocityUom); 
  foreach (FieldInfo fi in enumType.GetFields()) 
  {  object[] attrs = fi.GetCustomAttributes(typeof(XmlEnumAttribute), 
false); 
     if (attrs.Length > 0) 
     {  Console.WriteLine(((XmlEnumAttribute)attrs[0]).Name); 
     } 
  } 

My question is, while looping through the FieldInfo to get the string 
XMLEnumAttributes, is it possible to retrieve the corresponding enumerated 
(int) value for each string?

Can anyone help?

Thanks, 

Edward Clements 

0
5/22/2006 7:24:02 AM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
901 Views

Similar Articles

[PageSpeed] 47

Reply:

Similar Artilces:

Unlinked Chart Treats Time Axis As Value
I have a series of charts in separate workbooks, all with a time X-axis. For distribution, I copy just the charts - not the underlying data - to a new workbook. All looks good until I come to open the new workbook, when I find that the Y-axis has migrated from outside left to inside right, and buggered up the alignment with a second chart on the same sheet. When I look at the properties of the X-axis, I find that it's no longer a time axis, but a value axis; and that, instead of the Y-axis crossing at 8/1/2004, it now crosses at 27338 - even though the X-axis is still formatted as a date. ...

2 Exchange servers how does mail get to them
Hi I have just added a second exchange 2003 server to my organisation. At the moment there is 1 MX record for the original server. What is the best way to get mail to the second server? Leave the MX record and let exchange pass the email between servers or set a second MX record and let them both pass email between them for mailboxes on the other server? Any advice would be appreciated. M Leave the MX record as it is and let Exchange route mail to the appropriate mailbox. This simplifies your gateway anti-virus/anti-spam & firewall solution as there is only one point of mail entry i...

How to retrieve the string from dialog box
Hi All, Does anyone know how to retrieve a string in IDC_STATIC on a dialog box? I have to print out a report with an application version at the bottom line for users to be aware of it in my application. I don't know how to retrieve the string in IDC_STATIC control on a dialog box. It would be very nice that someone let me know how to do that without calling the dialog box. TIA Hwasoo Lee Back 9 wrote: > Hi All, > > Does anyone know how to retrieve a string in IDC_STATIC on a dialog box? > I have to print out a report with an application version at the bottom line &g...

Copying formulas Part 2
I have two worksheets open. In one, I can populate a cell with a formula, set the cell colors, font, and other attributes, and then double click on the fill cross (little black cross) and it will automatically fill the cells below it with like formulas, fonts, colors, etc... The other worksheet, this does not work. Is there a setting I'm overlooking? Neither sheet is protected or locked. I've gone through the options dialog box back and forth between the two worksheets, but I may have missed something. TIA Randy, Hi Randy double click will only work if there is data t...

DTPicker: Incrementing Time Value
I have a form with the following DTpicker's InterviewStart (format= "mm/dd/yyyy HH:mm") InterviewEnd (format= "mm/dd/yyyy HH:mm") When the user inserts a record, the InterviewStart field updates to Now(). I would like to set the default value of InterviewEnd to be 1.5 hours from Now(). How does the VBA code look in order to accomplish this? TIA! Hi Brandon, You might try something like: Me.InterviewEnd = DateAdd("h", 1.5, Now()) or Me.InterviewEnd = DateAdd("h", 1.5, Me.InterviewStart Hope that helps... "Bran...

Exporting to Excel #2
Some computers have an the option "EXPORT TO MICR. EXCEL" in their toolbar after right clicking on a webpage? I don't have that option but really need it. Can anyone help? Try the following in "no particular order" Copy the selection and paste it into excel Do a save as CSV (Comma Seperated Values) Do a save as Tab deliminated. If you try to import and everything goes into column A only. Selec column A and then in the "Font" selection Select "COURIER" and then yo might see where there are "possible" column breaks. If there are - the - ...

Pasting Values
Hi, I have developed a quoting tool which creates an output sheet detailing all the info, What I would like to be able to do is take a copy of this and paste the values (and Format to a new workbook). I'm currently doing this manually and I unsure how to automate it! I have never used VB which I'm guessing is the only way of doing it, so please be gentle!! Thanks, Sam. -- sammy2x ------------------------------------------------------------------------ sammy2x's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29674 View this thread: http://www.excelf...

#VALUE! Occuring in formula result
I have a formula in cell A1: =IF(ISNA(VLOOKUP(B9,ALL!A6:E1091,5,FALSE)=TRUE),"",VLOOKUP(B9,ALL!A6:E1091,5,FALSE)) I used this formula to eliminate the #N/A that would appear if no value is found in the vlookup. The result in A1 was #N/A, but now it is blank due to ISNA formula. However, now if I add cell A1 with others cells. =SUM(A1:A10), it returns #VALUE!. The blank cell as a result of the ISNA formula is causing this cell not to add. Please help.....Thanks, Richard --- Message posted from http://www.ExcelForum.com/ Use a zero instead of "". -- Kind Reg...

Message Recall Failure #2
Help! - I recently recalled a message to someone who had Out of Office Auto Reply Set and have since been inundated (50+) Message Recall Failure messages. I am running Outlook 2002 on Windows XP Home Edition. Would welcome any suggestions on stopping this. Thanks in advance. ...

retrieve an AVERAGE of a range using VLOOKUP to locate start/end d
Can I calculate the average of a range based on VLOOKUP? In other words, can I get Excel to "look up" the respective START / END dates of an investment position listed in Sheet 1 and then go and locate those 2 distinct cell values in in a different sheet (Sheet 2) utilizing VLOOKUP function and then return the calculated AVERAGE of the cells within that range back into Sheet 1? Appreciate any thoughts if doable in Excel in any way? tAKE A LOOK AT AverageIFS and see if that does what you want. If it were me, I'd probably enter the formula manually, record the resu...

That old #VALUE! problem
I have made up a spreadsheet that has lots of cells with IF formulas but I want the result of those cells to add up as a total. However, no matter how I try, the total cell keeps coming out with the dreaded #VALUE!. All the IF formulas are fine and work well but I need them all to add up but show nothing in the cell unless there is a value worked out in the original IF cells. Hope that's clear and that someone can help. I am using OFFICE2000. Nick What exactly is your formula? If you don't show us the formula that creates the problem we can't identify the problem, Any...

Consolidation of 2 SBS2003 domains into one Windows 2008+Exchange 2007
Hi all! I have to do a consolidation of two existent SBS2003 into a Windows 2008+Exchange 2007 (it is OK to either remain with one of the 2 SBS2003 domains in the end, either to have a new one). Which is the correct path that I should follow? I undestood that it is not possible to set trust relationships in SBS2003, so I suppost ADMT is not a solution? I have done various migrations and consolidations using ADMT before, but I'm not sure what is the correct procedure for this case, due to the SBS2003 limitations. Thank you, Rumburak. Hi Rumburak: Ther...

ctl.Text --vs-- ctl.Value
For Each ctl In Me.Section(acHeader).Controls --code-- Next ctl For an unbound textbox control in the header section of my form... ctl.Text stores "100" which is what I typed ctl.Value is null Why? What is the difference in these properties? -- Regards, John You will very rarely if ever need to use .text in your code. you'll often see some amateurs write the following code me.MyTextBox.SetFocus msgbox "the value is " & me.MytextBox.Text The problem is with the use of the dot text property, it is only valid and legal to use while the control has the foc...

Adding value to drop down list
I have a drop down list that functions using codes to determine a rat of pay by the hour. However, a couple of times a year, the payrol people pay lump sum payments that can vary. Is there a way to write drop down list with a "blank" so that the user's own data (amount to b paid) of an amount not specified in the drop down list can be added i by the user? Thanks for any advice in advance -- ne ----------------------------------------------------------------------- neb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1759 View this thread: http:/...

Mapping estimated value to totalamount
Hi, I define a map between opportunity estimated revenue and quote totalamount. I set the estimated revenue to be user provided and write a value by hand. The value is not carried to the totalamount field of the quote when I add a related quote. Instead it is calculated from the amount fields of the quote products. Is the totalamount field always system calculated, cannot we override it with the value in the estimated revenue? Thanks, Bilge Gul "b_gul_t" <bgult@discussions.microsoft.com> wrote in message news:840D5F58-34E8-4639-9A8C-C0508D9C9686@microsoft.com... > ...

Formatting Numbers #2
When I export data to excel it doesnt recognise the numbers as numbers. Even when I format the row to numbers it doesn't recognise them. I have to retype then in order for me to do calculations. Any help greatly appreciated. How are you exporting the data to Excel, and from where? Formatting does not change the value in a cell. In particular, it cannot change text to a number--it merely prepares the cell to accept a number. One possible workaround is to copy a blank cell, then select the range of imported data and Edit|Paste Special|Add. Adding zero to each cell should coerce ...

out of memory #2
When I try to open a PDF attachement I receive the message "OUT OF MEMORY OR SYSTEM RESOURCES. CLOSE SOME WINDOWS OR PROGRAMS AND TRY AGAIN". This is the only program or window I have open (othen then antivirus progam) I double click on the attachement - the next menu comes up and ask if I want to SAVE or OPEN - I click on OPEN and that is when the message appears. Please advise. Thanks - DJ ...

userform to 2 seperate sheets
XL2000 userform I am using this code for a userform to add parts to a sheet named parts and all works well as is I would also like it to add just the value of this line ws.Range("A" & r).Value = txtPartnumber.Value to sheet2 column DR starting at DR2 is it possible? Private Sub cmdAdd_Click() Dim r As Long Dim ws As Worksheet Set ws = Worksheets("Parts") With ws If .AutoFilterMode Then If .FilterMode Then .ShowAllData End If End If End With r = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row ws.Range("A" & r).Value = txtPartnumber....

Retrieve mouse position
Hi, I am writing an app in which I need to retrieve the mouse coordinates even when it mouse is outside the main frame. How do I do it? Thanks! xg >Hi, I am writing an app in which I need to retrieve the mouse coordinates >even when it mouse is outside the main frame. How do I do it? Thanks! Have you tried calling GetCursorPos? If you want to know when the mouse is moving I think you'll need to use a hook - have a look at SetWindowsHookEx WH_MOUSE. Dave IN addition to David's answer, you have not stated the problem you are trying to solve. For examp...

Value Entered Isn't Valid...Error
I have a cbo ShopName on my subform which is populated by ltblShop. The cbo displays the Name, but is bound by the ShopID. If the user doesn't enter a value, I want a msgbox to open confirming this and then entering "None", which is an item in my ltblShop. Admittedly, the idea of having a tbl for Shops which then has a "None" entry which isn't a shop feels wrong but seemed to be the most expedient at the time and easiest for such the novice that I am. The code for this upon entering and exiting that control seems to work fine. The box opens upon a...

vlookup for words content when there are duplicate values
Hi, Can somebody help me here. Thanks in advance. When I vlookup Material 1 to Material 2 for the Project No, I get the vlookup Project No. as 222-56 for all the duplicate Material values. How formula to use so that when there are duplicate values in Material2, I want to have vlookup searching to match Project No. containg "AA" as 1st choice ? (if no Project No. containing "AA", then looks for its content "AB" and subsequently looks for "AC" if there is no "AB"). ColumnA ColumnB ColumnC Material 2 Duplicate? Project No. 224410 duplica...

How can a value be converted to words
Is there a fromula if I have a total i.e. 123 to be converted in words i.e. One hundrd and twenty three automatically. http://support.microsoft.com/default.aspx?scid=kb;en-us;213360 or http://www.xldynamic.com/source/xld.xlFAQ0004.html tj "Azar" wrote: > Is there a fromula if I have a total i.e. 123 to be converted in words i.e. > One hundrd and twenty three automatically. ...

Retrieving messages
Help, I mistakenly restored all the defaults on Outlook (the computer did not crash) losing all the messages and address book. I have had to set up the application from scratch entering account details etc. Question is: are all the messages and contacts still held on the computer even the program needs to be set up again and, if so, how do I retrieve them. Any assistance greatly appreciated. Thanks. P89 If you made a backup of your system or My Documents, search for a file called Outlook.pst. If you have that you can import all the information. Al "peterson89" <peterson...

Retrieving comment using range name
I have singular cells in different places referenced by their range names. Is there a way to get the comments corresponding to the referenced ranges (singular cells)? Thanks in advance, Tomek Set testrng = Range("A3:A4", "C3:C4") comment1 = testrng(1).Comment.Text .... commentn = testrng(n).Comment.Text Stefi „topola” ezt írta: > I have singular cells in different places referenced by their range > names. Is there a way to get the comments corresponding to the > referenced ranges (singular cells)? > Thanks in advance, > Tomek > > did yo...

Linear Regression #2
THE DATA ARE THE PERCENTAGE EXAMINATION MARKS (Y) AND TH PERCENTAGE ATTENDANCE AT CLASSES (X) FOR A GROUP OF 40 STUDENTS, PERFORM A LINEAR REGRESSION OF Y ON X AND USE THIS TO DETERMINE TH FOLLOWING AMOUNTS. INTERCEPT (a) 12.60463992 GRADIENT (b) 0.699961906 PREDICTED VALUE OF Y WHEN X = 60% PREDICTED VALUE OF Y WHEN X = 0% CORRELATION COEFFICIENT 0.81440364 COEFFICIENT OF DETERMINATION ESTIMATED ATTENDANCE WHEN MARK = 50% MARK % ATTENDANCE % WORKING AREA IF NEEDED 45 48 ...