Simple parsing question

Hi all,
I have a simple yet confusing (for me) question.
I have created a scheduling type of scenario.
I want some code to fire at a certain time on certain days.
Now, here is my dilema:
I have set some values in the registry and I later read from there to determine the day of week.
But, I have this in the registry  1,3,5  for Mon,Wed,Fri.
I then read these values to see if I need to fire the code off.
My code to check:

        Dim WDay As String
        If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\.....\Value", True).GetValue("Daylog") = 0 Then
            WDay = "Sunday"
        End If
        If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\.....\Value", True).GetValue("Daylog") = 1 Then
            WDay = "Monday"
        End If
        If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\.....\Value", True).GetValue("Daylog") = 2 Then
            WDay = "Tuesday"
        End If
        If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\.....\Value", True).GetValue("Daylog") = 2 Then
            WDay = "Tuesday"
        End If
       If WDay = Date.Now.DayOfWeek.ToString Then
         my code here
      End If

But when it checks and there is more than one number, then nothing happens.
I gues I need to parse the values in some way; or maybe a better way to do this?
Help !!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In the scenerio that you outlined, you should use a comma-delimited list in the registry to store multiple values, then parse them when you read the.

'...code to get registry value and assign it to variable sRegValue....

Dim sDays() As String = sRegValue.Split

Dim sVal As String

For Each sVal in sDays
   MessageBox.Show sVal

This should show a message box for each value in the list.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
First why all the if's statments
try something like:

Dim Mytest as integer

Mytest = Val(Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\.....\Value", True).GetValue("Daylog") )

Select Case Mytest

   Case 1
      WDay = "Sunday"
   Case 2
      WDay = "Monday"
   Case 3
      WDay = "Tuesday"
Case Else
    'What ever you need to do if the right value is not selected such as setting it to a defualt value or something
End Case

Note this is air code
I hope  this helps
AkulaAuthor Commented:
Thanks willcode; that is exactly what I needed!!

Your code was extremely helpful as well.
I will post a question worth 100 points for you as well.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.