KB Issue
The IF ELSE Statement has to be inside the SUB(), not outside of it.
Issue Details
BC30689: Statement cannot appear outside of a method body/multiline lambda.
Source Error:
Line 14:Dim theSubID as string = request.querystring("subID")
Line 15:Dim thePT as string = request.querystring("Payment")
Line 16:if thePT = "Monthly" Then
Line 17:ThePay = "$5.00"
Line 18:Else
Source File: G:\Inetpub\wwwroot\website.com\Controls\Payments.ascx.vb Line: 16
Recreate Issue
When developing the page to process payments, I built the IF-ELSE statement outside the SUB(). This type of programming is done by habit, since that's how I did it in ASP Classic.
[ASP.NET - Proper Location for IF ELSE Statement]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)
if thePT = "Monthly" Then
	ThePay = "$5.00"
	Else
	ThePay = "$50.00"
	end if
Private Sub Process()
' Insert or Update Statement here.
End Sub

Resolve Issue
Move the IF ELSE
Copy
Search Site
Search Google
Statement into the SUB()
[ASP.NET - Proper Location for IF ELSE Statement]
CFFCS | CarrzSynEdit: | ASP.NET (VB/C#)
Private Sub Process()
	if thePT = "Monthly" Then
	ThePay = "$5.00"
	Else
	ThePay = "$50.00"
	end if
' Insert or Update Statement here.
End Sub