Showing posts with label ASPX. Show all posts
Showing posts with label ASPX. Show all posts

Sunday, August 4, 2013

Modifying Your ASP Code to ASPX VB.Net

This could have been a very old topic as ASP (VB) has been phased out long ago and VB.Net is almost obsolete compared with C#. Although VB and VB.net are using the same programming language, the way they work on a web page is vastly different.

Anyway, let's go with the fun of migrating from one programming environment to another.

ASP (VB)

<%
.
.
Dim orange
orange = "apple"
.
.
.
%>

<html>
<body>
.
.
...<%=orange%> . . .
.
.
.
</body>

</html>



ASPX (VB.Net)

<%@ import Namespace="System.IO" %>
<%@ Page Language="vb" Debug="true" %>

<script language="vb" runat="server">

Private orange as String

Sub Page_Load()
.
.
orange = "apple"
.
.
End Sub

</script>

<html>

<body>
.
.
...<% Response.Write(orange) %> . . .
.
.
.
</body>

</html>



It's hard to get used to the new structure of VB.net initially. But once you get it done error-free a few times, you'll get used to it. There are also some syntax changes in VB.net compared to the old VB such as the use of "+" to concatenate strings together instead of using "&".

Anyway, that's all for now and happy coding!!!

Read More »