This little piece of code is supposed to fire off and give me the correct variable but no matter what is in the variable "numericDay", the Variable "suffix" gives me "th". i don't see why it wouldn't change when the value of "numericDay changes both are string variables.
Select Case numericDay
Case numericDay = "1" Or "21" Or "31"
suffix = "st"
Case numericDay = "2" Or "22"
suffix = "nd"
Case numericDay = "3" Or "23"
suffix = "rd"
Case Else
suffix = "th"
End Select
A Select Case statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each select case.
Syntax of Select Case Statement in VB.Netyour_expression: this denotes an expression which evaluates to one of the elementary Data Types supported in Microsoft VB.NET. expression_list: expression clauses that denote the match values for the expression. For the case of multiple clauses, separate them using a comma (,).
Visual Basic is case-insensitive, but the common language runtime (CLR) is case-sensitive. For more information, see "Case Sensitivity in Names" in Declared Element Names.
You've written your select incorrectly. Try the following:
Select Case numericDay
Case "1", "21", "31"
suffix = "st"
Case "2", "22"
suffix = "nd"
Case "3", "23"
suffix = "rd"
Case Else
suffix = "th"
End Select
For future reference: http://www.vb6.us/tutorials/learn-if-else-and-select-statements-vb6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With