473,382 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

finding the best way to...

This is the situation I have. I have to read 8 registry values and assign
them to variables. The value held in each of those variables corresponds to
a different flag. So, for example, one set of registry values can have 0,1
or 2 as their value and each of those corresponds to a flag that I want to
report on. Another set of values has 6 possible values, also corresponding
to some flags. What I'm trying to figure out is, what is the most efficient
way of converting the decimal values of each registry value into its
corresponding textual flag. I'm stuck on having to do a monstrous number of
if..thens and it seems like there should be a more efficient way. I know the
value and I know what flag that corresponds to, but I'm having a hard time
figuring out how to convert value to flag in the least possible steps.

Thanks!

Darren

--
Darren Mar-Elia
MS-MVP-Windows Server--Group Policy
Check out http://www.gpoguy.com -- The Windows Group Policy Information Hub:
FAQs, Training Videos, Whitepapers and Utilities for all things Group
Policy-related
GPOGUY Blog: http://blogs.dirteam.com/blogs/gpoguy


Aug 23 '06 #1
1 1107
Awesome Ben. Thanks for that. I knew there was an easier way!
--
Darren Mar-Elia
MS-MVP-Windows Server--Group Policy
Check out http://www.gpoguy.com -- The Windows Group Policy Information Hub:
FAQs, Training Videos, Whitepapers and Utilities for all things Group
Policy-related
GPOGUY Blog: http://blogs.dirteam.com/blogs/gpoguy

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Declare an enum for each set of flags with the different values, then cast
your integer to that enum type and call ToString.

For Example

int myregvar = 1;

enum RegVarValue
{
None = 0,
Few = 1,
Some = 2,
Lots = 3
}

((RegVarValue)myregvar).ToString() should give you "Few"

"Darren Mar-Elia (MVP)" <dm*********@discussions.microsoft.comwrote in
message news:uH**************@TK2MSFTNGP04.phx.gbl...
>This is the situation I have. I have to read 8 registry values and assign
them to variables. The value held in each of those variables corresponds
to a different flag. So, for example, one set of registry values can have
0,1 or 2 as their value and each of those corresponds to a flag that I
want to report on. Another set of values has 6 possible values, also
corresponding to some flags. What I'm trying to figure out is, what is
the most efficient way of converting the decimal values of each registry
value into its corresponding textual flag. I'm stuck on having to do a
monstrous number of if..thens and it seems like there should be a more
efficient way. I know the value and I know what flag that corresponds to,
but I'm having a hard time figuring out how to convert value to flag in
the least possible steps.

Thanks!

Darren

--
Darren Mar-Elia
MS-MVP-Windows Server--Group Policy
Check out http://www.gpoguy.com -- The Windows Group Policy Information
Hub:
FAQs, Training Videos, Whitepapers and Utilities for all things Group
Policy-related
GPOGUY Blog: http://blogs.dirteam.com/blogs/gpoguy



Aug 23 '06 #2

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

Similar topics

11
by: Picture Dots | last post by:
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr?Examples? Also - how...
11
by: Fuzzyman | last post by:
What's the best, cross platform, way of finding out the directory a script is run from ? I've googled a bit, but can't get a clear answer. On sys.argv the docs say : argv is the script name...
1
by: Phil Watkins | last post by:
I am a novice programer in Vb and I am having a major brain ache finding out which item has been selected within a list view and then either deleting that item or editing them. My searching so...
3
by: KL | last post by:
Well, I am back. This time our assignment has us filling a vector and then timing how long it takes to find a spot in the vector to insert a new item, and the time required to insert the item...
14
by: Mr. B | last post by:
I want to return the name of the drawing file (DWG) from the end of a string. The string will be of varying lengths... as well as the drawing file name itself. I could do it the long way by...
9
by: Laurent Bugnion | last post by:
Hi, I am wondering what is the best way to find out which ASP.NET sessions are still active. Here is the reason: I have a custom control which can upload files. It saves the files in a folder...
15
by: cwsullivan | last post by:
Hi gang, I have a grid full of particles in my program, and I want to find an angle between two particles. I'm having trouble because it seems like the answer depends on whether or not the target...
0
by: U S Contractors Offering Service A Non-profit | last post by:
This Sunday the 26th 2006 there will be Music @ Tue Nov Inbox Reply Craig Somerford to me show details 9:54 pm (26 minutes ago) #1St "CLICK" HeAt frOm A blanket...
1
by: Mike Heywood | last post by:
Hi, I am currently trying to automate a process that I have been studying the manual results from for a while. The process simply identifies events that meet certain criteria and at the moment...
4
by: krishnai888 | last post by:
I had already asked this question long back but no one has replied to me..I hope someone replies to me because its very important for me as I am doing my internship. I am currently writing a code...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.