Net-informations.com
SiteMap  | About    

switch case

The switch statement allows you to choose from many statements based on multiple selections by passing control to one of the case statements within its body. The switch statement can include any number of case instances. In VB.Net it is using as Select...Case statement and C# it is using as switch..case .

vb.net
  Select Case expression
	[Case expression list]
		[statements]

End Select

C#
  switch (expression)
  {
	case expression:
	statements

}

The following ASP.NET program evaluates which value is passing in case statement.

Default.aspx

  

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
		<br />
		<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
	</div>
	</form>
</body>
</html>


Click the following links to see full source code

C# Source Code
VB.NET Source Code
Default.aspx.cs
Default.aspx.vb





net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.