28 th Jun 2022 21:19:07
Hai Friend , Sign In
Home
World
INDIA
Chennai City
Games
Developers
Members
Birthday
Search
Astrology
G. K.
Story
Tamil Nadu Government Holiday List 2018 in English and Tamil   *   Trichy: Wanted - PHP, MySql Programmers. Contact trichy people only 84894 28 444.   *   Indian Railways New Train Number List [Search / Enquiry / Locator / Finder]   *   பன்றிக் காய்ச்சல் பற்றி அறிந்து கொள்ளுங்கள் (Swine Flu H1N1)
See Also
Choose Function Choose Function
Math Functions Math Functions
Visual Basic Functions Visual Basic Functions
Visual Basic Home Visual Basic Home
 
Description  Syntax  Return Datatype  Example  Migration

Switch Function - Visual Basic 6.0 (VB 6.0)

Evaluates a list of expressions and returns a Variant value or an expression associated with the first expression in the list that is True.
Syntax:
Switch(expr-1, value-1[, expr-2, value-2 … [, expr-n,value-n]])
Parameter Description
expr Required. Variant expression you want to evaluate.
value Required. Value or expression to be returned if the corresponding expression is True.

Return Data type:
Variant.
Example:
Dim vStr
vStr = "IV" 'Roman Letter 4
Statement Result Remark
Switch(vStr = "I", "One", vStr = "IV", "Four") Four  
Switch(vStr = "I", "One", vStr = "iv", "Four") Null Case Sensitive
Switch(vStr = "I", "One", vStr = "IV", Null) Null Value of True Expr.
Switch(True, "One", True, "Four") One First Occurrence
Switch(vStr = "I", MsgBox("one"), vStr = "IV", Msgbox("Four")) 1 After evaluate the Values.

Migration from Visual Basic 6.0 (VB 6.0) to
  Switch Function in VB Script (VBS)
  Switch Function in JScript (JS)
  Switch Function in ASP (Active Server Page)
  Switch Function in PHP Script
  Switch Function in MS-Access
  Switch Function in MS SQL Server
  Switch Function in Oracle
  Switch Function in C Language
  Switch Function in C++ Language
  Switch Function in Foxpro
  Switch Function in Fortran
  Switch Function in MS Excel Sheet
Go to top
 





© 2021 Chennaiiq.com. All Rights Reserved.

4274