Link to home
Start Free TrialLog in
Avatar of Akula
Akula

asked on

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 !!

Ak
ASKER CERTIFIED SOLUTION
Avatar of willcode4coffee
willcode4coffee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Akula
Akula

ASKER

Thanks willcode; that is exactly what I needed!!

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

Ak