Select case not working


Little issue here, that I should be able to figure out, but can’t.

I want to select a tab on a TabPanel by the day, so I did the following:

[code]dim myDay as new Date
MessageBox "The Day is "+(myDay.DayOfWeek.ToString) // just for testing

select case myDay
Case 0
Messagebox “Monday”
Case 1
Messagebox “Tuesday”
Case 2
Messagebox “Wednesday”
Case 3
Messagebox “Thursday”
Case 4
Messagebox “Friday”
Case 5
Messagebox “Saturday”
Case 6
Messagebox “Sunday”
end select[/code]

The myDay (as of today) shows 5 for Thursday

When I try and run my program, I get the error message

Undefined operator Type date does not define “=” with type int64.

Any ideas?


You’re trying to select the state of myDate, not the DayOfWeek property. One small update should get you moving again:

select case myDay.DayOfWeek

Thanks Mr. Parnell! A cookie for you… delivered via ALOT of social distancing!



The docs say DayOfWeek values are 1-7 Sunday-Saturday.

Hi Alberto.

Yeah. I read that too… so I had to do a little simple math to make things work out.