How to find the date for Monday in vb.net

In VB6 I could use the following code to find the date for Monday of the current week:
dteMonday = Format(Date - (IIf(Weekday(Date) >= vbMonday, Weekday(Date) - vbMonday, 7 - (vbMonday - Weekday(Date)))))

Is there a way to do this in vb.net? Thanks!
myesterAsked:
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.

iboutchkineCommented:
I think that must give you previous Monday

        Dim dtMon As Date
        If Today.DayOfWeek = DayOfWeek.Monday Then
            dtMon = Today
        Else
            dtMon = Today.AddDays(1 - Today.DayOfWeek)
        End If
0

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
myesterAuthor Commented:
iboutchkine, thanks for the help. This is much easier to do in vb.net than in VB6. I had to make one small addition to account for if Today is Sunday. If Today is Sunday then dtMon was returing the next day vs the previous Monday. I.E. if Today is Sunday Feb 23rd dtMon was returing 02/24/2003 vs 02/17/2003 which is what I am looking for. I corrected for it like this:

Select Case Today.DayOfWeek
            Case DayOfWeek.Monday
                dtMon = Today
            Case DayOfWeek.Sunday
                dtMon = Today.AddDays(Today.DayOfWeek - 6)
            Case Else
                dtMon = Today.AddDays(1 - Today.DayOfWeek)
End Select

Thanks again for you help.
0
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
.NET Programming

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.