Select Case troubles... (1 Viewer)

Myriad_Rocker

Questioning Reality
Local time
Yesterday, 19:46
Joined
Mar 26, 2004
Messages
166
This won't work for some reason. I know the date going into it is 9/1

Code:
ElseIf thedate.Month = 9 And thedate.DayOfWeek = DayOfWeek.Monday Then
            Select Case thedate.Day
                Case 1 To 7
                    thedate.AddDays(1)
            End Select
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:46
Joined
Jul 2, 2005
Messages
13,825
How about including a little more of the surrounding code so we can tell what each element is? What is thedate.? How about DayOfWeek.Monday?
 

Myriad_Rocker

Questioning Reality
Local time
Yesterday, 19:46
Joined
Mar 26, 2004
Messages
166
How about including a little more of the surrounding code so we can tell what each element is? What is thedate.? How about DayOfWeek.Monday?

thedate is simply a variable that has the date from a textbox in it. The textbox value is being cast as a date type and put into thedate. I know that the value of thedate is 9/1 when going into that section of code because I stepped through it.

DayOfWeek.Monday is just the intellisense stuff that comes up. It's a aspx vb.net thing, I guess.
 

Myriad_Rocker

Questioning Reality
Local time
Yesterday, 19:46
Joined
Mar 26, 2004
Messages
166
I got it. One small difference.

Code:
ElseIf thedate.Month = 9 And thedate.DayOfWeek = DayOfWeek.Monday Then
            Select Case thedate.Day
                Case 1 To 7
                    thedate = thedate.AddDays(1)
            End Select
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:46
Joined
Jul 2, 2005
Messages
13,825
Excellent! Thanks for popsting back with your success.
 

datAdrenaline

AWF VIP
Local time
Yesterday, 19:46
Joined
Jun 23, 2008
Messages
697
Would you please be so kind as to hilite the difference? ... I can not see a difference between the two code blocks you posted :eek: ...
 

boblarson

Smeghead
Local time
Yesterday, 17:46
Joined
Jan 12, 2001
Messages
32,059
Would you please be so kind as to hilite the difference? ... I can not see a difference between the two code blocks you posted :eek: ...

Brent:

Instead of

thedate.AddDays(1)

He changed to:
thedate = thedate.AddDays(1)
 

datAdrenaline

AWF VIP
Local time
Yesterday, 19:46
Joined
Jun 23, 2008
Messages
697
Bob ...

Thanks buddy ... Its plain as day now!!! .... <dazed and confused> ... :D
 

Users who are viewing this thread

Top Bottom